コード例 #1
0
 private void OnParentChanged(object instance, object key, DependencyObjectParentChangedEventArgs args)
 {
     // Set Content to null when we are removed from TemplatedParent. Otherwise Content.RemoveFromSuperview() may
     // be called when it is attached to a different view.
     if (args.NewParent == null)
     {
         Content = null;
     }
 }
コード例 #2
0
 private void OnElementParentChanged(object instance, object key, DependencyObjectParentChangedEventArgs args)
 {
     if (args.NewParent == _appBarButtonWrapper)
     {
         // if the new Parent is the wrapper, restore it to
         // its original value.
         Element?.SetParent(args.PreviousParent);
     }
 }
コード例 #3
0
 private void OnTitleViewParentChanged(object instance, object key, DependencyObjectParentChangedEventArgs args)
 {
     // Even though we set the CommandBar as the parent of the TitleView,
     // it will change to the native control when the view is added.
     // This control is the visual parent but is not a DependencyObject and will not propagate the DataContext.
     // In order to ensure the DataContext is propagated properly, we restore the CommandBar
     // parent that can propagate the DataContext.
     if (args.NewParent != Element && args.NewParent != null)
     {
         _titleView.SetParent(Element);
     }
 }
コード例 #4
0
ファイル: TextBox.cs プロジェクト: Robert-Louis/Uno
 private void OnParentChanged(object instance, object key, DependencyObjectParentChangedEventArgs args) => UpdateFontPartial();