当前位置: 首页>>代码示例>>C#>>正文


C# DependencyObject.SaftyInvoke方法代码示例

本文整理汇总了C#中System.Windows.DependencyObject.SaftyInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# DependencyObject.SaftyInvoke方法的具体用法?C# DependencyObject.SaftyInvoke怎么用?C# DependencyObject.SaftyInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.DependencyObject的用法示例。


在下文中一共展示了DependencyObject.SaftyInvoke方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DelayBinding

        protected DelayBinding(BindingExpressionBase bindingExpression, DependencyObject bindingTarget, DependencyProperty bindingTargetProperty, TimeSpan delay)
        {
            _bindingExpression = bindingExpression;
            _delay = delay;

            // Subscribe to notifications for when the target property changes. This event handler will be 
            // invoked when the user types, clicks, or anything else which changes the target property
            _descriptor = DependencyPropertyDescriptor.FromProperty(bindingTargetProperty, bindingTarget.GetType());


            // Add support so that the Enter key causes an immediate commit


            bindingTarget.SaftyInvoke<FrameworkElement>(el =>
                                                            {
                                                                el.Loaded += OnBindingTargetLoaded;
                                                            });

            // Setup the timer, but it won't be started until changes are detected

            _timer = new DispatcherTimer();
            _timer.Tick += TimerTick;
            _timer.Interval = _delay;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:24,代码来源:DelayBindingExtension.cs

示例2: RemoveDraggingHandler

 public static void RemoveDraggingHandler(DependencyObject d, DraggingRoutedEventHandler handler)
 {
     d.SaftyInvoke<UIElement>(uie => uie.RemoveHandler(DraggingEvent, handler));
 }
开发者ID:Mrding,项目名称:Ribbon,代码行数:4,代码来源:MoveDargItemsLayer.cs

示例3: RemoveSelectedHandler

 public static void RemoveSelectedHandler(DependencyObject d, RoutedEventHandler handler)
 {
     d.SaftyInvoke<UIElement>(uie => uie.RemoveHandler(SelectedEvent, handler));
 }
开发者ID:Mrding,项目名称:Ribbon,代码行数:4,代码来源:RangeSelected.cs

示例4: OnRegisterCommandBindingChanged

        private static void OnRegisterCommandBindingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //sender.SaftyInvoke<UIElement>(el =>
            //                                  {
            //                                      var bindings = e.NewValue as CommandBindingCollection;
            //                                      if (bindings != null)
            //                                          el.CommandBindings.AddRange(bindings);
            //                                  });

            var bindings = e.NewValue as CommandBindingCollection;
            if (bindings == null)
                return;


            sender.SaftyInvoke<UIElement>(el =>
            {
                if (bindings.Count != el.CommandBindings.Count)
                {
                    foreach (CommandBinding binding in bindings)
                    {
                        if (el.CommandBindings.Contains(binding))
                            continue;
                        el.CommandBindings.Add(binding);
                    }
                }
            });

        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:28,代码来源:CommandBidingBehavior.cs

示例5: RemoveEndEditHandler

 public static void RemoveEndEditHandler(DependencyObject d, CellEditRoutedEventHandler handler)
 {
     d.SaftyInvoke<UIElement>(uie => uie.RemoveHandler(EndEditEvent, handler));
 }
开发者ID:Mrding,项目名称:Ribbon,代码行数:4,代码来源:EditControlLayer.cs


注:本文中的System.Windows.DependencyObject.SaftyInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。