Exemplo n.º 1
0
 /// <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;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        private static void onChildrenPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var scopedStorybaord = o.As <ScopedStoryboard>();

            scopedStorybaord.onChildrenChanged(o, EventArgs.Empty);
            scopedStorybaord.Children.Changed += scopedStorybaord.onChildrenChanged;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 protected override void OnRemove(DependencyObject view, RemoveReason reason)
 {
     view.As <MenuItem>(e =>
     {
         if (this.Element.Items.Contains(e))
         {
             this.Element.Items.Remove(e);
         }
     });
 }
Exemplo n.º 5
0
 /// <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);
         }
     });
 }
Exemplo n.º 6
0
        private static void OnForcedResourceChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
        {
            var frameworkElement = dependencyObject.As <FrameworkElement>();

            if (frameworkElement == null)
            {
                return;
            }

            frameworkElement.Resources = args.NewValue as ResourceDictionary;
        }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
 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>());
         }
     }
 }
Exemplo n.º 9
0
        /// <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);
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
 static void OnAngleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <AnglePicker>().OnAngleChanged((double)e.NewValue);
 }
Exemplo n.º 13
0
 static void OnBackgroundColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <DualColorChip>().OnBackgroundColorChanged((Color)e.NewValue);
 }
Exemplo n.º 14
0
 static void OnTokenDelimiterChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e)
 {
     Object.As <TokenView>().OnTokenDelimiterChanged((char)e.OldValue, (char)e.NewValue);
 }
Exemplo n.º 15
0
 static void OnTokenStyleChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e)
 {
     Object.As <TokenView>().OnTokenStyleChanged((Style)e.OldValue, (Style)e.NewValue);
 }
Exemplo n.º 16
0
 static void OnTokensSourceChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e)
 {
     Object.As <TokenView>().OnTokensSourceChanged((string)e.NewValue);
 }
Exemplo n.º 17
0
 static void OnQueryOnExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <StoragePicker>().OnQueryOnExpandedChanged((bool)e.NewValue);
 }
Exemplo n.º 18
0
        /// <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);
        }
Exemplo n.º 19
0
 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>());
 }
Exemplo n.º 21
0
 static void OnSelectedObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <TreeViewExt>().OnSelectedObjectChanged(e.NewValue);
 }
Exemplo n.º 22
0
 static void OnSystemObjectProviderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <StoragePicker>().OnSystemObjectProviderChanged((ISystemObjectProvider)e.NewValue);
 }
Exemplo n.º 23
0
 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);
        }
Exemplo n.º 25
0
 static void OnKindChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <DateTimeUpDown>().OnKindChanged((DateTimeKind)e.NewValue);
 }
Exemplo n.º 26
0
 static void OnIsDropDownOpenChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e)
 {
     Object.As <DateTimeUpDown>().OnIsDropDownOpenChanged((bool)e.NewValue);
 }
Exemplo n.º 27
0
 static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <Chip <T> >().OnValueChanged((T)e.NewValue);
 }
Exemplo n.º 28
0
 private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <MaskedButton>().OnSourceChanged((ImageSource)e.NewValue);
 }
Exemplo n.º 29
0
 static void OnDropDownChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.As <MaskedButton>().OnDropDownChanged((ContextMenu)e.NewValue);
 }
Exemplo n.º 30
0
 static void OnPropertyChanged(DependencyObject Object, DependencyPropertyChangedEventArgs e)
 {
     Object.As <RippleDecorator>().OnPropertyChanged(e.NewValue);
 }