diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-06-16 09:45:09 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-06-16 16:45:09 +0100 |
commit | d5be2f0144ca810fdfbf59808d526c26fe86017e (patch) | |
tree | 3ad7e4465307cd6d633184e05d85eb3a4df59e01 /Xamarin.Forms.Platform.iOS/Renderers | |
parent | 04f7bd296ee67af9189ecd7fdfbd2808ca16ce9a (diff) | |
download | xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.gz xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.bz2 xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.zip |
Prep Page for removal of InternalsVisibleTo (#150)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers')
13 files changed, 82 insertions, 54 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs index 16e97cd2..6e7c6b2a 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs @@ -37,11 +37,15 @@ namespace Xamarin.Forms.Platform.iOS WantsFullScreenLayout = true; } + IElementController ElementController => Element as IElementController; + protected CarouselPage Carousel { get { return (CarouselPage)Element; } } + IPageController PageController => (IPageController)Element; + protected int SelectedIndex { get { return (int)(_scrollView.ContentOffset.X / _scrollView.Frame.Width); } @@ -98,7 +102,7 @@ namespace Xamarin.Forms.Platform.iOS return; _appeared = true; - Carousel.SendAppearing(); + PageController.SendAppearing(); } public override void ViewDidDisappear(bool animated) @@ -109,7 +113,7 @@ namespace Xamarin.Forms.Platform.iOS return; _appeared = false; - Carousel.SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLayoutSubviews() @@ -139,9 +143,9 @@ namespace Xamarin.Forms.Platform.iOS View.Add(_scrollView); - for (var i = 0; i < Element.LogicalChildren.Count; i++) + for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { - Element element = Element.LogicalChildren[i]; + Element element = ElementController.LogicalChildren[i]; var child = element as ContentPage; if (child != null) InsertPage(child, i); @@ -199,7 +203,7 @@ namespace Xamarin.Forms.Platform.iOS if (_appeared) { _appeared = false; - Carousel.SendDisappearing(); + PageController?.SendDisappearing(); } if (_events != null) @@ -266,10 +270,10 @@ namespace Xamarin.Forms.Platform.iOS void OnDecelerationEnded(object sender, EventArgs eventArgs) { - if (_ignoreNativeScrolling || SelectedIndex >= Element.LogicalChildren.Count) + if (_ignoreNativeScrolling || SelectedIndex >= ElementController.LogicalChildren.Count) return; - Carousel.CurrentPage = (ContentPage)Element.LogicalChildren[SelectedIndex]; + Carousel.CurrentPage = (ContentPage)ElementController.LogicalChildren[SelectedIndex]; } void OnPagesChanged(object sender, NotifyCollectionChangedEventArgs e) @@ -335,9 +339,9 @@ namespace Xamarin.Forms.Platform.iOS { Clear(); - for (var i = 0; i < Element.LogicalChildren.Count; i++) + for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { - Element element = Element.LogicalChildren[i]; + Element element = ElementController.LogicalChildren[i]; var child = element as ContentPage; if (child != null) InsertPage(child, i); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs index 6d70d7c5..a591243c 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs @@ -38,6 +38,8 @@ namespace Xamarin.Forms.Platform.iOS UIDatePicker _picker; UIColor _defaultTextColor; + IElementController ElementController => Element as IElementController; + protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e) { base.OnElementChanged(e); @@ -93,18 +95,17 @@ namespace Xamarin.Forms.Platform.iOS void HandleValueChanged(object sender, EventArgs e) { - if (Element != null) - ((IElementController)Element).SetValueFromRenderer(DatePicker.DateProperty, _picker.Date.ToDateTime().Date); + ElementController?.SetValueFromRenderer(DatePicker.DateProperty, _picker.Date.ToDateTime().Date); } void OnEnded(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } void OnStarted(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void UpdateDateFromModel(bool animate) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs index 4d5a3f99..939a9841 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs @@ -23,6 +23,8 @@ namespace Xamarin.Forms.Platform.iOS { UIToolbar _accessoryView; + IElementController ElementController => Element as IElementController; + public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint) { if (!Forms.IsiOS7OrNewer) @@ -106,7 +108,7 @@ namespace Xamarin.Forms.Platform.iOS void HandleChanged(object sender, EventArgs e) { - ((IElementController)Element).SetValueFromRenderer(Editor.TextProperty, Control.Text); + ElementController.SetValueFromRenderer(Editor.TextProperty, Control.Text); } void OnEnded(object sender, EventArgs eventArgs) @@ -117,7 +119,7 @@ namespace Xamarin.Forms.Platform.iOS void OnStarted(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void UpdateEditable() diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs index 2e8908a5..f946de89 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs @@ -20,6 +20,8 @@ namespace Xamarin.Forms.Platform.iOS Frame = new RectangleF(0, 20, 320, 40); } + IElementController ElementController => Element as IElementController; + protected override void Dispose(bool disposing) { if (disposing) @@ -99,17 +101,17 @@ namespace Xamarin.Forms.Platform.iOS void OnEditingBegan(object sender, EventArgs e) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void OnEditingChanged(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(Entry.TextProperty, Control.Text); + ElementController.SetValueFromRenderer(Entry.TextProperty, Control.Text); } void OnEditingEnded(object sender, EventArgs e) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } bool OnShouldReturn(UITextField view) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs index 37ae8d29..a08365e8 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs @@ -45,6 +45,8 @@ namespace Xamarin.Forms.Platform.iOS { bool _isDisposed; + IElementController ElementController => Element as IElementController; + protected override void Dispose(bool disposing) { if (_isDisposed) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index 5fb69c0d..be069e98 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -52,6 +52,8 @@ namespace Xamarin.Forms.Platform.iOS Page Current { get; set; } + IPageController PageController => Element as IPageController; + public VisualElement Element { get; private set; } public event EventHandler<VisualElementChangedEventArgs> ElementChanged; @@ -143,7 +145,7 @@ namespace Xamarin.Forms.Platform.iOS if (!_appeared) { _appeared = true; - ((NavigationPage)Element)?.SendAppearing(); + PageController?.SendAppearing(); } base.ViewDidAppear(animated); @@ -159,7 +161,7 @@ namespace Xamarin.Forms.Platform.iOS return; _appeared = false; - ((NavigationPage)Element).SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLayoutSubviews() @@ -176,7 +178,7 @@ namespace Xamarin.Forms.Platform.iOS double trueBottom = toolbar.Hidden ? toolbarY : toolbar.Frame.Bottom; var modelSize = _queuedSize.IsZero ? Element.Bounds.Size : _queuedSize; - ((NavigationPage)Element).ContainerArea = + PageController.ContainerArea = new Rectangle(0, toolbar.Hidden ? 0 : toolbar.Frame.Height, modelSize.Width, modelSize.Height - trueBottom); if (!_queuedSize.IsZero) @@ -275,7 +277,7 @@ namespace Xamarin.Forms.Platform.iOS base.Dispose(disposing); if (_appeared) { - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); _appeared = false; } @@ -850,7 +852,7 @@ namespace Xamarin.Forms.Platform.iOS { if (disposing) { - Child.SendDisappearing(); + ((IPageController)Child).SendDisappearing(); Child = null; _tracker.Target = null; _tracker.CollectionChanged -= TrackerOnCollectionChanged; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs index 6db3fb61..ff286537 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs @@ -19,6 +19,8 @@ namespace Xamarin.Forms.Platform.iOS VisualElementPackager _packager; VisualElementTracker _tracker; + IPageController PageController => Element as IPageController; + public PageRenderer() { if (!Forms.IsiOS7OrNewer) @@ -78,7 +80,7 @@ namespace Xamarin.Forms.Platform.iOS return; _appeared = true; - ((Page)Element).SendAppearing(); + PageController.SendAppearing(); } public override void ViewDidDisappear(bool animated) @@ -89,7 +91,7 @@ namespace Xamarin.Forms.Platform.iOS return; _appeared = false; - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLoad() @@ -132,7 +134,7 @@ namespace Xamarin.Forms.Platform.iOS Element.PropertyChanged -= OnHandlePropertyChanged; Platform.SetRenderer(Element, null); if (_appeared) - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); _appeared = false; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs index e4c73521..55ed9610 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs @@ -37,6 +37,8 @@ namespace Xamarin.Forms.Platform.iOS VisualElementTracker _tracker; + IPageController PageController => Element as IPageController; + public PhoneMasterDetailRenderer() { if (!Forms.IsiOS7OrNewer) @@ -112,13 +114,13 @@ namespace Xamarin.Forms.Platform.iOS public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); - ((Page)Element).SendAppearing(); + PageController.SendAppearing(); } public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLayoutSubviews() @@ -198,7 +200,7 @@ namespace Xamarin.Forms.Platform.iOS EmptyContainers(); - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); _disposed = true; } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs index 7b5461e2..bebf91cf 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs @@ -24,6 +24,8 @@ namespace Xamarin.Forms.Platform.iOS UIPickerView _picker; UIColor _defaultTextColor; + IElementController ElementController => Element as IElementController; + protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { if (e.OldElement != null) @@ -86,12 +88,12 @@ namespace Xamarin.Forms.Platform.iOS void OnEnded(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } void OnStarted(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void RowsCollectionChanged(object sender, EventArgs e) @@ -119,7 +121,7 @@ namespace Xamarin.Forms.Platform.iOS if (Element != null) { var oldText = Control.Text; - ((IElementController)Element).SetValueFromRenderer(Picker.SelectedIndexProperty, s.SelectedIndex); + ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, s.SelectedIndex); Control.Text = s.SelectedItem; UpdatePickerNativeSize(oldText); } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs index a7e37c98..90a24376 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs @@ -20,6 +20,8 @@ namespace Xamarin.Forms.Platform.iOS UIColor _defaultTintColor; UITextField _textField; + IElementController ElementController => Element as IElementController; + protected override void Dispose(bool disposing) { if (disposing) @@ -130,20 +132,18 @@ namespace Xamarin.Forms.Platform.iOS void OnCancelClicked(object sender, EventArgs args) { - ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, null); + ElementController.SetValueFromRenderer(SearchBar.TextProperty, null); Control.ResignFirstResponder(); } void OnEditingEnded(object sender, EventArgs e) { - if (Element != null) - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } void OnEditingStarted(object sender, EventArgs e) { - if (Element != null) - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void OnSearchButtonClicked(object sender, EventArgs e) @@ -154,7 +154,7 @@ namespace Xamarin.Forms.Platform.iOS void OnTextChanged(object sender, UISearchBarTextChangedEventArgs a) { - ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, Control.Text); + ElementController.SetValueFromRenderer(SearchBar.TextProperty, Control.Text); } void UpdateAlignment() diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs index 2db8ac26..4ec16967 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs @@ -26,6 +26,9 @@ namespace Xamarin.Forms.Platform.iOS bool _loaded; Size _queuedSize; + IPageController PageController => Element as IPageController; + IElementController ElementController => Element as IElementController; + public override UIViewController SelectedViewController { get { return base.SelectedViewController; } @@ -102,14 +105,14 @@ namespace Xamarin.Forms.Platform.iOS public override void ViewDidAppear(bool animated) { - ((TabbedPage)Element).SendAppearing(); + PageController.SendAppearing(); base.ViewDidAppear(animated); } public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); - ((TabbedPage)Element).SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLayoutSubviews() @@ -126,7 +129,7 @@ namespace Xamarin.Forms.Platform.iOS var frame = View.Frame; var tabBarFrame = TabBar.Frame; - ((TabbedPage)Element).ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height); + PageController.ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height); if (!_queuedSize.IsZero) { @@ -149,7 +152,7 @@ namespace Xamarin.Forms.Platform.iOS { if (disposing) { - ((TabbedPage)Element).SendDisappearing(); + PageController.SendDisappearing(); Tabbed.PropertyChanged -= OnPropertyChanged; Tabbed.PagesChanged -= OnPagesChanged; FinishedCustomizingViewControllers -= HandleFinishedCustomizingViewControllers; @@ -258,9 +261,9 @@ namespace Xamarin.Forms.Platform.iOS void SetControllers() { var list = new List<UIViewController>(); - for (var i = 0; i < Element.LogicalChildren.Count; i++) + for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { - var child = Element.LogicalChildren[i]; + var child = ElementController.LogicalChildren[i]; var v = child as VisualElement; if (v == null) continue; @@ -352,7 +355,7 @@ namespace Xamarin.Forms.Platform.iOS var originalIndex = -1; if (int.TryParse(viewControllers[i].TabBarItem.Tag.ToString(), out originalIndex)) { - var page = (Page)Tabbed.InternalChildren[originalIndex]; + var page = (TabbedPage)((IPageController)Tabbed).InternalChildren[originalIndex]; TabbedPage.SetIndex(page, i); } } @@ -360,7 +363,8 @@ namespace Xamarin.Forms.Platform.iOS void UpdateCurrentPage() { - ((TabbedPage)Element).CurrentPage = SelectedIndex >= 0 && SelectedIndex < Tabbed.InternalChildren.Count ? Tabbed.GetPageByIndex((int)SelectedIndex) : null; + var count = ((IPageController)Tabbed).InternalChildren.Count; + ((TabbedPage)Element).CurrentPage = SelectedIndex >= 0 && SelectedIndex < count ? Tabbed.GetPageByIndex((int)SelectedIndex) : null; } void IEffectControlProvider.RegisterEffect(Effect effect) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs index e49ed5ae..cb76b765 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs @@ -59,6 +59,9 @@ namespace Xamarin.Forms.Platform.iOS VisualElementTracker _tracker; + IPageController PageController => Element as IPageController; + IElementController ElementController => Element as IElementController; + protected MasterDetailPage MasterDetailPage { get { return _masterDetailPage ?? (_masterDetailPage = (MasterDetailPage)Element); } @@ -77,7 +80,7 @@ namespace Xamarin.Forms.Platform.iOS { if (Element != null) { - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); Element.PropertyChanged -= HandlePropertyChanged; Element = null; } @@ -155,7 +158,7 @@ namespace Xamarin.Forms.Platform.iOS public override void ViewDidAppear(bool animated) { - ((Page)Element).SendAppearing(); + PageController.SendAppearing(); base.ViewDidAppear(animated); ToggleMaster(); } @@ -163,7 +166,7 @@ namespace Xamarin.Forms.Platform.iOS public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); - ((Page)Element).SendDisappearing(); + PageController.SendDisappearing(); } public override void ViewDidLayoutSubviews() @@ -277,14 +280,14 @@ namespace Xamarin.Forms.Platform.iOS { _masterVisible = true; if (MasterDetailPageController.CanChangeIsPresented) - ((IElementController)Element).SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, true); + ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, true); } void MasterControllerWillDisappear(object sender, EventArgs e) { _masterVisible = false; if (MasterDetailPageController.CanChangeIsPresented) - ((IElementController)Element).SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, false); + ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, false); } void PerformButtonSelector() diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs index 55dbf1c8..f8529800 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs @@ -26,6 +26,8 @@ namespace Xamarin.Forms.Platform.iOS UIDatePicker _picker; UIColor _defaultTextColor; + IElementController ElementController => Element as IElementController; + protected override void Dispose(bool disposing) { if (disposing) @@ -89,17 +91,17 @@ namespace Xamarin.Forms.Platform.iOS void OnEnded(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); } void OnStarted(object sender, EventArgs eventArgs) { - ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); + ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); } void OnValueChanged(object sender, EventArgs e) { - ((IElementController)Element).SetValueFromRenderer(TimePicker.TimeProperty, _picker.Date.ToDateTime() - new DateTime(1, 1, 1)); + ElementController.SetValueFromRenderer(TimePicker.TimeProperty, _picker.Date.ToDateTime() - new DateTime(1, 1, 1)); } void UpdateTextColor() |