protected override void OnDetachedFromWindow() { if (_backPressedEventHandler != null && _window != null) { try { _window.BackPressed -= _backPressedEventHandler; _window = null; _backPressedEventHandler = null; } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } } base.OnDetachedFromWindow(); }
private bool ShowFull() { if (Item == null || !Item.CanExpand()) { return(false); } if (_backPressedEventHandler == null) { try { // Wire the back press event _backPressedEventHandler = new WeakEventHandler <CancelEventArgs>(MyBaseEventVisual_BackPressed).Handler; _window = PortableApp.Current.GetCurrentWindow(); _window.BackPressed += _backPressedEventHandler; } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } } if (_expandedContainer.ChildCount == 0) { _expandedContainer.AddView(GenerateFullContent(Item)); } _isFullShown = true; //var dontWait = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, delegate //{ // if (_isFullShown) // { _expandedContainer.Visibility = ViewStates.Visible; // } //}); return(true); }