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


C# DependencyObject类代码示例

本文整理汇总了C#中DependencyObject的典型用法代码示例。如果您正苦于以下问题:C# DependencyObject类的具体用法?C# DependencyObject怎么用?C# DependencyObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SetBinding

		public static void SetBinding ( 
			DependencyObject target, 
			DependencyProperty property,
			Binding binding ) {

			throw new NotImplementedException ( );
		}
开发者ID:bbqchickenrobot,项目名称:WPFLight,代码行数:7,代码来源:BindingOperations.cs

示例2: HandlePreviewMouseDown

 /// <summary>
 /// Handles the <see cref="Mouse.PreviewMouseDownEvent"/>.
 /// </summary>
 private static void HandlePreviewMouseDown(DependencyObject element, MouseDevice device, MouseButton button, ref RoutedEventData data)
 {
     if (button == MouseButton.Left)
     {
         ((SliderBase)element).Focus();
     }
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:10,代码来源:SliderBase.cs

示例3: Parse

        /// <summary>
        /// Parses the specified message text.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="text">The message text.</param>
        /// <returns>The triggers parsed from the text.</returns>
        public static IEnumerable<TriggerBase> Parse(DependencyObject target, string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return new TriggerBase[0];
            }

            var triggers = new List<TriggerBase>();
            var messageTexts = Split(text, ';');

            foreach (var messageText in messageTexts)
            {
                var triggerPlusMessage = LongFormatRegularExpression.IsMatch(messageText)
                                             ? Split(messageText, '=')
                                             : new[] { null, messageText };

                var messageDetail = triggerPlusMessage.Last()
                    .Replace("[", string.Empty)
                    .Replace("]", string.Empty)
                    .Trim();

                var trigger = CreateTrigger(target, triggerPlusMessage.Length == 1 ? null : triggerPlusMessage[0]);
                var message = CreateMessage(target, messageDetail);

                trigger.Actions.Add(message);
                triggers.Add(trigger);
            }

            return triggers;
        }
开发者ID:bdvsoft,项目名称:reader_wp8_OPDS,代码行数:36,代码来源:Parser.cs

示例4: OnBehaviorsChanged

        private static void OnBehaviorsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var oldBehaviorCollection = (BehaviorCollection)e.OldValue;
            var newBehaviorCollection = (BehaviorCollection)e.NewValue;

            if (oldBehaviorCollection == newBehaviorCollection)
            {
                return;
            }

            if (oldBehaviorCollection != null)
            {
#if WINDOWS_PHONE
                var associatedObject = typeof(BehaviorCollection)
                    .GetProperty("AssociatedObject", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                    .GetValue(oldBehaviorCollection);
#else
                var associatedObject = oldBehaviorCollection.AssociatedObject;
#endif
                if (associatedObject != null)
                {
                    oldBehaviorCollection.Detach();
                }
            }

            if (newBehaviorCollection == null || d == null)
            {
                return;
            }

            newBehaviorCollection.Attach(d);
        }
开发者ID:HimanshPal,项目名称:Cimbalino-Toolkit,代码行数:32,代码来源:MonitoredInteraction.cs

示例5: AddPreviewAxisChangedHandler

        /// <summary>
        /// Adds a handler for the PreviewAxisChanged attached event to the specified element.
        /// </summary>
        /// <param name="element">The element to which to add the handler.</param>
        /// <param name="handler">The handler to add to the specified element.</param>
        public static void AddPreviewAxisChangedHandler(DependencyObject element, UpfGamePadAxisChangedEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.AddHandler(element, PreviewAxisChangedEvent, handler);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:12,代码来源:GamePad.cs

示例6: PositionPropertyChanged

        //------------------------------------------------------ 
        //
        //  Public Properties 
        //
        //-----------------------------------------------------

        private static void PositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
        {
            PointLightBase target = ((PointLightBase) d); 
 

            target.PropertyChanged(PositionProperty); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:13,代码来源:PointLightBase.cs

示例7: OnMenuFlyoutChanged

        /// <summary>
        /// Handles changes to the MenuFlyout DependencyProperty.
        /// </summary>
        /// <param name="o">DependencyObject that changed.</param>
        /// <param name="e">Event data for the DependencyPropertyChangedEvent.</param>
        private static void OnMenuFlyoutChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var element = o as FrameworkElement;

            if (null != element)
            {
                // just in case we were here before and there is no new menu
                element.Holding -= OnElementHolding;

                MenuFlyout oldMenuFlyout = e.OldValue as MenuFlyout;

                if (null != oldMenuFlyout)
                {
                    // Remove previous attachment
                    element.SetValue(FlyoutBase.AttachedFlyoutProperty, null);
                }

                MenuFlyout newMenuFlyout = e.NewValue as MenuFlyout;

                if (null != newMenuFlyout)
                {
                    // attach using FlyoutBase to easier show the menu
                    element.SetValue(FlyoutBase.AttachedFlyoutProperty, newMenuFlyout);

                    // need to show it
                    element.Holding += OnElementHolding;
                }
            }
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:34,代码来源:MenuFlyoutService.cs

示例8: DirectionPropertyChanged

        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void DirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DirectionalLight target = ((DirectionalLight) d);


            target.PropertyChanged(DirectionProperty);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:13,代码来源:DirectionalLight.cs

示例9: OnMinimumDistanceBetweenChildrenPropertyChanged

 /// <summary>
 /// MinimumDistanceBetweenChildrenProperty property changed handler.
 /// </summary>
 /// <param name="d">OrientedPanel that changed its MinimumDistanceBetweenChildren.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnMinimumDistanceBetweenChildrenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     OrientedPanel source = (OrientedPanel)d;
     double oldValue = (double)e.OldValue;
     double newValue = (double)e.NewValue;
     source.OnMinimumDistanceBetweenChildrenPropertyChanged(oldValue, newValue);
 }
开发者ID:stavrianosy,项目名称:BudgetManagementAssistant,代码行数:12,代码来源:OrientedPanel.cs

示例10: VisualTreeChangeEventArgs

 public VisualTreeChangeEventArgs(DependencyObject parent, DependencyObject child, int childIndex, VisualTreeChangeType changeType)
 {
     Parent = parent;
     Child = child;
     ChildIndex = childIndex;
     ChangeType = changeType;
 }
开发者ID:mind0n,项目名称:hive,代码行数:7,代码来源:VisualTreeChangeEventArgs.cs

示例11: OnHeaderChanged

        /// <summary>
        ///     Called when HeaderProperty is invalidated on "d." 
        /// </summary> 
        private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        { 
            HeaderedItemsControl ctrl = (HeaderedItemsControl) d;

            ctrl.SetValue(HasHeaderPropertyKey, (e.NewValue != null) ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox);
            ctrl.OnHeaderChanged(e.OldValue, e.NewValue); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:HeaderedItemsControl.cs

示例12: CheckTarget

		static void CheckTarget (DependencyObject target)
		{
			if (target == null)
				throw new ArgumentNullException ("target");
			if (!(target is TextBox))
				throw new ArgumentException ("target is not a TextBox", "target");
		}
开发者ID:kangaroo,项目名称:moon,代码行数:7,代码来源:InputMethod.cs

示例13: OnSizePropertyChanged

 private static void OnSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     PredefinedMarkerStyle style = d as PredefinedMarkerStyle;
     style.OnPropertyChanged("Size");
     style.OnPropertyChanged("OffsetX");
     style.OnPropertyChanged("OffsetY");
 }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:7,代码来源:PredefinedMarkerStyle.cs

示例14: RemoveGenericInteractionHandler

        /// <summary>
        /// Removes a handler for the GenericInteraction attached event to the specified element.
        /// </summary>
        /// <param name="element">The element from which to remove the handler.</param>
        /// <param name="handler">The handler to remove from the specified element.</param>
        public static void RemoveGenericInteractionHandler(DependencyObject element, UpfTouchTapEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.RemoveHandler(element, GenericInteractionEvent, handler);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:12,代码来源:Generic.cs

示例15: AddPreviewTapHandler

        /// <summary>
        /// Adds a handler for the PreviewGenericInteraction attached event to the specified element.
        /// </summary>
        /// <param name="element">The element to which to add the handler.</param>
        /// <param name="handler">The handler to add to the specified element.</param>
        public static void AddPreviewTapHandler(DependencyObject element, UpfGenericInteractionEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.AddHandler(element, PreviewGenericInteractionEvent, handler);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:12,代码来源:Generic.cs


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