/// <summary> /// Sets IsExpanded property to specified value on all TreeViewItems found. /// </summary> public static void ToggleAll(this DependencyObject Object, bool IsExpanded) { if (Object.Is <TreeViewItem>()) { ((TreeViewItem)Object).IsExpanded = IsExpanded; foreach (DependencyObject d in ((TreeViewItem)Object).Items) { d.ToggleAll(IsExpanded); } } else if (Object.Is <ItemsControl>()) { foreach (var i in Object.As <ItemsControl>().Items) { if (i != null) { Object.As <ItemsControl>().ItemContainerGenerator.ContainerFromItem(i).ToggleAll(IsExpanded); TreeViewItem t = i.As <TreeViewItem>(); if (t != null) { t.IsExpanded = IsExpanded; } } } } }
private static void onChildrenPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { var scopedStorybaord = o.As <ScopedStoryboard>(); scopedStorybaord.onChildrenChanged(o, EventArgs.Empty); scopedStorybaord.Children.Changed += scopedStorybaord.onChildrenChanged; }
protected override void OnHostAttached( DependencyObject host) { var frameworkElement = host.As <FrameworkElement>(); frameworkElement.MouseMove += OnHostMouseMove; frameworkElement.IsMouseDirectlyOverChanged += OnIsMouseDirectlyOverHostChanged; frameworkElement.GotFocus += OnHostGotFocus; frameworkElement.LostFocus += OnHostLostFocus; frameworkElement.GotKeyboardFocus += OnHostGotKeyboardFocus; frameworkElement.LostKeyboardFocus += OnHostLostKeyboardFocus; frameworkElement.GotStylusCapture += OnHostGotStylusCapture; frameworkElement.LostStylusCapture += OnHostLostStylusCapture; frameworkElement.GotTouchCapture += OnHostGotTouchCapture; frameworkElement.LostTouchCapture += OnHostLostTouchCapture; frameworkElement.ManipulationStarting += OnHostManipulationStarting; frameworkElement.ManipulationStarted += OnHostManipulationStarted; frameworkElement.ManipulationInertiaStarting += OnHostManipulationInertiaStarting; frameworkElement.ManipulationDelta += OnHostManipulationDelta; frameworkElement.ManipulationBoundaryFeedback += OnHostManipulationBoundaryFeedback; frameworkElement.ManipulationCompleted += OnHostManipulationCompleted; base.OnHostAttached(host); }
protected override void OnRemove(DependencyObject view, RemoveReason reason) { view.As <MenuItem>(e => { if (this.Element.Items.Contains(e)) { this.Element.Items.Remove(e); } }); }
/// <summary> /// Called before the remove operation. /// </summary> /// <param name="view">The view.</param> /// <param name="reason">The reason.</param> protected override void OnRemove(DependencyObject view, RemoveReason reason) { view.As <UIElement>(e => { if (this.Element.Children.Contains(e)) { this.Element.Children.Remove(e); } }); }
private static void OnForcedResourceChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { var frameworkElement = dependencyObject.As <FrameworkElement>(); if (frameworkElement == null) { return; } frameworkElement.Resources = args.NewValue as ResourceDictionary; }
/// <summary> /// Adds a child at the given index. /// </summary> /// <param name="parent">The parent view.</param> /// <param name="child">The child view.</param> /// <param name="index">The index.</param> public override void AddView(BorderedCanvas parent, DependencyObject child, int index) { if (HasBorder(parent)) { index++; } var uiElementChild = child.As <UIElement>(); parent.Children.Insert(index, uiElementChild); }
private static void onIdentityChanged( DependencyObject @this, DPChangedEventArgs <MaterialIdentity> args) { if (args.NewValue != null) { if (!_registeredIdentities.ContainsKey(args.NewValue)) { _registeredIdentities.Add( args.NewValue, @this.As <SolidColorBrush>()); } } }
/// <summary> /// Adds a child at the given index. /// </summary> /// <param name="parent">The parent view.</param> /// <param name="child">The child view.</param> /// <param name="index">The index.</param> public override void AddView(ReactControl parent, DependencyObject child, int index) { if (index != 0) { throw new ArgumentOutOfRangeException(nameof(index), "WindowsControl only supports one child."); } if (parent.Children.Count > 0) { throw new ArgumentOutOfRangeException(nameof(index), "WindowsControl already has a child element."); } var uiElementChild = child.As <UIElement>(); parent.Children.Insert(index, uiElementChild); }
private static void onTargetNameChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { var storyboardTemplate = o.As <StoryboardTemplate>(); if (storyboardTemplate.IsInitialized) { storyboardTemplate.GenerateStoryboardTree(); return; } if (storyboardTemplate._isInitializeHooked) { return; } storyboardTemplate.Initialized += (s, args) => { storyboardTemplate.GenerateStoryboardTree(); }; storyboardTemplate._isInitializeHooked = true; }
public override void AddView(SplitView parent, DependencyObject child, int index) { if (index != 0 && index != 1) { throw new ArgumentOutOfRangeException( nameof(index), Invariant($"'{Name}' only supports two child, the content and the pane.")); } var uiElementChild = child.As <UIElement>(); if (index == 0) { parent.Content = uiElementChild; } else { parent.Pane = uiElementChild; } }
static void OnAngleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <AnglePicker>().OnAngleChanged((double)e.NewValue); }
static void OnBackgroundColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <DualColorChip>().OnBackgroundColorChanged((Color)e.NewValue); }
static void OnTokenDelimiterChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e) { Object.As <TokenView>().OnTokenDelimiterChanged((char)e.OldValue, (char)e.NewValue); }
static void OnTokenStyleChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e) { Object.As <TokenView>().OnTokenStyleChanged((Style)e.OldValue, (Style)e.NewValue); }
static void OnTokensSourceChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e) { Object.As <TokenView>().OnTokensSourceChanged((string)e.NewValue); }
static void OnQueryOnExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <StoragePicker>().OnQueryOnExpandedChanged((bool)e.NewValue); }
/// <summary> /// Adds a child at the given index. /// </summary> /// <param name="parent">The parent view.</param> /// <param name="child">The child view.</param> /// <param name="index">The index.</param> protected override void AddView(TCanvas parent, DependencyObject child, int index) { var uiElementChild = child.As <UIElement>(); parent.Children.Insert(index, uiElementChild); }
static async void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { await d.As <PropertyGridBase <TSource> >().OnSourceChanged((TSource)e.OldValue, (TSource)e.NewValue); }
/// <summary> /// Adds a child at the given index. /// </summary> /// <param name="parent">The parent view.</param> /// <param name="child">The child view.</param> /// <param name="index">The index.</param> public override void AddView(BorderedCanvas parent, DependencyObject child, int index) { parent.Children.Insert(index, child.As <UIElement>()); }
static void OnSelectedObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <TreeViewExt>().OnSelectedObjectChanged(e.NewValue); }
static void OnSystemObjectProviderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <StoragePicker>().OnSystemObjectProviderChanged((ISystemObjectProvider)e.NewValue); }
static void OnRootChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <StoragePicker>().OnRootChanged((string)e.NewValue); }
/// <summary> /// Adds a child at the given index. /// </summary> /// <param name="parent">The parent view.</param> /// <param name="child">The child view.</param> /// <param name="index">The index.</param> public sealed override void AddView(TPanel parent, DependencyObject child, int index) { var uiElementChild = child.As <UIElement>(); parent.Children.Insert(index, uiElementChild); }
static void OnKindChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <DateTimeUpDown>().OnKindChanged((DateTimeKind)e.NewValue); }
static void OnIsDropDownOpenChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e) { Object.As <DateTimeUpDown>().OnIsDropDownOpenChanged((bool)e.NewValue); }
static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <Chip <T> >().OnValueChanged((T)e.NewValue); }
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <MaskedButton>().OnSourceChanged((ImageSource)e.NewValue); }
static void OnDropDownChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { d.As <MaskedButton>().OnDropDownChanged((ContextMenu)e.NewValue); }
static void OnPropertyChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e) { Object.As <RippleDecorator>().OnPropertyChanged(e.NewValue); }