private static void Entry_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "Parent") { var s = sender as Element; if (s.Parent != null) { VisualTreeHelper.Include(sender as Element); } else { VisualTreeHelper.Exclude(sender as Element); } } }
static void OnIncludeChanged(BindableObject view, object oldValue, object newValue) { var entry = view as Cell; if (entry == null) { return; } bool register = (bool)newValue; if (register) { entry.Appearing += Entry_Appearing; entry.PropertyChanged += Entry_PropertyChanged; } else { entry.Appearing -= Entry_Appearing; entry.PropertyChanged -= Entry_PropertyChanged; VisualTreeHelper.Exclude(entry as Element); } }
private static void Entry_Disappearing(object sender, EventArgs e) { //Debug.WriteLine("Entry_Disappearing"); VisualTreeHelper.Exclude(sender as Element); }