void IVisualElementRenderer.SetElement(VisualElement element) { FlyoutPage oldElement = Element; FlyoutPage newElement = Element = element as FlyoutPage; if (oldElement != null) { DeviceDisplay.MainDisplayInfoChanged -= DeviceInfoPropertyChanged; ((IFlyoutPageController)oldElement).BackButtonPressed -= OnBackButtonPressed; oldElement.PropertyChanged -= HandlePropertyChanged; oldElement.Appearing -= FlyoutPageAppearing; oldElement.Disappearing -= FlyoutPageDisappearing; RemoveDrawerListener(this); if (_detailLayout != null) { RemoveView(_detailLayout); } if (_flyoutLayout != null) { RemoveView(_flyoutLayout); } } if (newElement != null) { if (_detailLayout == null) { _detailLayout = new FlyoutPageContainer(newElement, false, Context) { LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) }; _flyoutLayout = new FlyoutPageContainer(newElement, true, Context) { LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = (int)GravityFlags.Start } }; if (_fragmentManager != null) { _detailLayout.SetFragmentManager(_fragmentManager); _flyoutLayout.SetFragmentManager(_fragmentManager); } AddView(_detailLayout); AddView(_flyoutLayout); DeviceDisplay.MainDisplayInfoChanged += DeviceInfoPropertyChanged; AddDrawerListener(this); } UpdateBackgroundColor(newElement); UpdateBackgroundImage(newElement); UpdateFlyout(); UpdateDetail(); UpdateFlowDirection(); ((IFlyoutPageController)newElement).BackButtonPressed += OnBackButtonPressed; newElement.PropertyChanged += HandlePropertyChanged; newElement.Appearing += FlyoutPageAppearing; newElement.Disappearing += FlyoutPageDisappearing; SetGestureState(); Presented = newElement.IsPresented; newElement.SendViewInitialized(this); } OnElementChanged(oldElement, newElement); // Make sure to initialize this AFTER event is fired if (_tracker == null) { _tracker = new VisualElementTracker(this); } if (element != null && !string.IsNullOrEmpty(element.AutomationId)) { SetAutomationId(element.AutomationId); } SetContentDescription(); }
void SetTracker(VisualElementTracker tracker) { _tracker = tracker; }
protected void SetTracker(VisualElementTracker tracker) { Tracker = tracker; }