• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DependencyProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetBinding

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

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


示例2: Selector

		public Selector ()
		{
			selectedItem = BuildProperty<UIElement> ("SelectedItem");
			selectedItem.DependencyPropertyValueChanged += HandleSelectedItemChanged;

			Items.CollectionChanged += HandleItemsChanged;
		}
开发者ID:olegsur,项目名称:moro.PresentationFramework,代码行数:7,代码来源:Selector.cs


示例3: DependencyPropertyChangedEventArgs

 public DependencyPropertyChangedEventArgs(
     DependencyProperty property, object oldValue, object newValue)
 {
     Property = property;
     OldValue = oldValue;
     NewValue = newValue;
 }
开发者ID:SchwarzerLoewe,项目名称:AttachedXaml,代码行数:7,代码来源:DependencyPropertyChangedEventHandler.cs


示例4: SingleAnimationGameAction

 /// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="parent">The parent task.</param>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 public SingleAnimationGameAction(IGameAction parent, SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty)
     : base(parent, "SingleAnimationGameAction" + instances++)
 {
     this.animation = animation;
     this.singleAnimation = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
开发者ID:WaveEngine,项目名称:Components,代码行数:14,代码来源:SingleAnimationGameAction.cs


示例5: RunTest

    public void RunTest()
    {
        MHashTable *hash = create_hashtable();
        Map map;

        DependencyProperty dp1, dp2;

        dp1 = new DependencyProperty ();
        dp1.native = (IntPtr)0x01;
        dp1.name = "DP-0x01";

        map.obj = dp1;
        hash->Insert (dp1.native, map.intptr);

        dp2 = new DependencyProperty ();
        dp2.native = (IntPtr)0x02;
        dp2.name = "DP-0x02";

        map.obj = dp2;
        hash->Insert (dp2.native, map.intptr);

        IntPtr ip = hash->Lookup ((IntPtr)0x01);

        if (ip == IntPtr.Zero) {
            Console.WriteLine ("null!?");
        }
        else {
            map.intptr = ip;
            DependencyProperty prop = (DependencyProperty)map.obj;

            Console.WriteLine ("dp property = {0}", prop.name);
        }

        test_hashtable ((IntPtr)hash);
    }
开发者ID:toshok,项目名称:mlib,代码行数:35,代码来源:MHashTest.cs


示例6: _OnApplyProperty

        internal static void _OnApplyProperty(TextEditor This, DependencyProperty formattingProperty, object propertyValue, bool applyToParagraphs, PropertyValueAction propertyValueAction)
        {
            if (This == null || !This._IsEnabled || This.IsReadOnly || !This.AcceptsRichContent || !(This.Selection is TextSelection))
            {
                return;
            }

            // Check whether the property is known
            if (!TextSchema.IsParagraphProperty(formattingProperty) && !TextSchema.IsCharacterProperty(formattingProperty))
            {
                Invariant.Assert(false, "The property '" + formattingProperty.Name + "' is unknown to TextEditor");
                return;
            }

            TextSelection selection = (TextSelection)This.Selection;

            if (TextSchema.IsStructuralCharacterProperty(formattingProperty) &&
                !TextRangeEdit.CanApplyStructuralInlineProperty(selection.Start, selection.End))
            {
                // Ignore structural commands fires in inappropriate context.
                return;
            }

            TextEditorTyping._FlushPendingInputItems(This);

            // Forget previously suggested horizontal position
            TextEditorSelection._ClearSuggestedX(This);

            // Break merged typing sequence
            TextEditorTyping._BreakTypingSequence(This);

            // Apply property
            selection.ApplyPropertyValue(formattingProperty, propertyValue, applyToParagraphs, propertyValueAction);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:34,代码来源:TextEditorCharacters.cs


示例7: BeginAnimation

        /// <summary>
        /// Starts animating a dependency property of a framework element to a 
        /// target value.
        /// </summary>
        /// <param name="target">The element to animate.</param>
        /// <param name="animatingDependencyProperty">The dependency property to
        /// animate.</param>
        /// <param name="propertyPath">The path of the dependency property to 
        /// animate.</param>
        /// <param name="targetValue">The value to animate the dependency
        /// property to.</param>
        /// <param name="timeSpan">The duration of the animation.</param>
        /// <param name="easingFunction">The easing function to uses to
        /// transition the data points.</param>
        public static void BeginAnimation(
            this FrameworkElement target,
            DependencyProperty animatingDependencyProperty,
            string propertyPath,
            object targetValue,
            TimeSpan timeSpan)
        {
            Storyboard storyBoard = target.Resources[GetStoryboardKey(propertyPath)] as Storyboard;

            if (storyBoard != null)
            {
                // Save current value
                object currentValue = target.GetValue(animatingDependencyProperty);
                storyBoard.Stop();
                // Restore that value so it doesn't snap back to its starting value
                target.SetValue(animatingDependencyProperty, currentValue);
                target.Resources.Remove(GetStoryboardKey(propertyPath));
            }

            storyBoard = CreateStoryboard(target, animatingDependencyProperty, propertyPath, ref targetValue, timeSpan);

            storyBoard.Completed += 
                (source, args) =>
                    {
                        storyBoard.Stop();
                        target.SetValue(animatingDependencyProperty, targetValue);
                        target.Resources.Remove(GetStoryboardKey(propertyPath));
                    };

            target.Resources.Add(GetStoryboardKey(propertyPath), storyBoard);
            storyBoard.Begin();
        }
开发者ID:stavrianosy,项目名称:BudgetManagementAssistant,代码行数:46,代码来源:DependencyPropertyAnimationHelper.cs


示例8: DependencyPropertyChangedEventArgs

		public DependencyPropertyChangedEventArgs (DependencyProperty property, object oldValue, object newValue)
			: this ()
		{
			this.Property = property;
			this.OldValue = oldValue;
			this.NewValue = newValue;
		}
开发者ID:nagyist,项目名称:ClanceyLib,代码行数:7,代码来源:DependencyPropertyChangedEventArgs.cs


示例9: ClearValue

        public void ClearValue(DependencyProperty dp)
        {
            if (IsSealed)
                throw new InvalidOperationException("Cannot manipulate property values on a sealed Dependency Object");

            _properties[dp] = null;
        }
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:7,代码来源:Form.cs


示例10: SuspendHandler

        private static void SuspendHandler(this DependencyObject obj, DependencyProperty dependencyProperty, bool suspend)
        {
            if (_suspendedHandlers.ContainsKey(obj))
            {
                Dictionary<DependencyProperty, bool> suspensions = _suspendedHandlers[obj];

                if (suspend)
                {
                    Debug.Assert(!suspensions.ContainsKey(dependencyProperty), "suspensions unexpectedly contain dependencyProperty");
                    suspensions[dependencyProperty] = true; // true = dummy value
                }
                else
                {
                    Debug.Assert(suspensions.ContainsKey(dependencyProperty), "suspensions unexpectedly do not contain dependencyProperty");
                    suspensions.Remove(dependencyProperty);
                    if (suspensions.Count == 0)
                    {
                        _suspendedHandlers.Remove(obj);
                    }
                }
            }
            else
            {
                Debug.Assert(suspend, "suspend unexpectedly false");
                _suspendedHandlers[obj] = new Dictionary<DependencyProperty, bool>();
                _suspendedHandlers[obj][dependencyProperty] = true;
            }
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:28,代码来源:DependencyObjectExtensions.cs


示例11: Helper

			public Helper(FrameworkElement obj, DependencyProperty property, Action<object, object> changed, object currentValue)
			{
				this.obj = obj;
				this.property = property; 
				this.changed = changed;
				this.currentValue = currentValue;
			}
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:7,代码来源:DependencyPropertyChangedEvent.cs


示例12: SuspendHandler

        /// <summary>
        /// Inherited code: Requires comment.
        /// </summary>
        /// <param name="obj">Inherited code: Requires comment 1.</param>
        /// <param name="dependencyProperty">Inherited code: Requires comment 2.</param>
        /// <param name="suspend">Inherited code: Requires comment 3.</param>
        private static void SuspendHandler(this DependencyObject obj, DependencyProperty dependencyProperty, bool suspend)
        {
            if (_suspendedHandlers.ContainsKey(obj))
            {
                Dictionary<DependencyProperty, bool> suspensions = _suspendedHandlers[obj];

                if (suspend)
                {
                    Debug.Assert(!suspensions.ContainsKey(dependencyProperty), "Suspensions should not contain the property!");

                    // true = dummy value
                    suspensions[dependencyProperty] = true;
                }
                else
                {
                    Debug.Assert(suspensions.ContainsKey(dependencyProperty), "Suspensions should contain the property!");
                    suspensions.Remove(dependencyProperty);
                    if (suspensions.Count == 0)
                    {
                        _suspendedHandlers.Remove(obj);
                    }
                }
            }
            else
            {
                Debug.Assert(suspend, "suspend should be true!");
                _suspendedHandlers[obj] = new Dictionary<DependencyProperty, bool>();
                _suspendedHandlers[obj][dependencyProperty] = true;
            }
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:36,代码来源:CalendarExtensions.cs


示例13: GetValueCore

 public override object GetValueCore(DependencyObject d, DependencyProperty dp)
 {
     if (Source != null)
         return GetValueCore(Source);
     if (ElementName == null)
         if (d is FrameworkElement)
         {
             FrameworkElement element = (FrameworkElement)d;
             while (element != null)
             {
                 if (element.DataContext != null)
                     return GetValueCore(element.DataContext);
                 element = element.VisualParent as FrameworkElement;
             }
             return null;
         }
         else
             return null;
     if ((d is Visual) && dp == NameScope.NameScopeProperty)
         return null;
     INameScope nameScope = NameScope.GetNameScope(d);
     if (nameScope == null)
         return null;
     object source = nameScope.FindName(ElementName);
     return GetValueCore(source);
 }
开发者ID:Kation,项目名称:WebPresentation,代码行数:26,代码来源:BindingExpression.cs


示例14: SingleAnimationGameAction

 /// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 /// <param name="scene">The associated scene.</param>
 public SingleAnimationGameAction(SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty, Scene scene = null)
     : base("SingleAnimationGameAction" + instances++, scene)
 {
     this.animation = animation;
     this.singleAnimation = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
开发者ID:nagyistoce,项目名称:WaveEngine-Components,代码行数:14,代码来源:SingleAnimationGameAction.cs


示例15: SquareRootToken

		public SquareRootToken ()
		{
			child = BuildProperty<Token> ("Child");
			child.DependencyPropertyValueChanged += HandleValueChanged;

			Child = new TextToken ();
		}
开发者ID:Octavio,项目名称:moro.fkalc,代码行数:7,代码来源:SquareRootToken.cs


示例16: SuspendHandler

        private static void SuspendHandler(this DependencyObject obj, DependencyProperty dependencyProperty, bool suspend)
        {
            if (_suspendedHandlers.ContainsKey(obj))
            {
                Dictionary<DependencyProperty, bool> suspensions = _suspendedHandlers[obj];

                if (suspend)
                {
                    Debug.Assert(!suspensions.ContainsKey(dependencyProperty));
                    suspensions[dependencyProperty] = true; // 
                }
                else
                {
                    Debug.Assert(suspensions.ContainsKey(dependencyProperty));
                    suspensions.Remove(dependencyProperty);
                    if (suspensions.Count == 0)
                    {
                        _suspendedHandlers.Remove(obj);
                    }
                }
            }
            else
            {                
                Debug.Assert(suspend);
                _suspendedHandlers[obj] = new Dictionary<DependencyProperty, bool>();
                _suspendedHandlers[obj][dependencyProperty] = true;
            }
        }
开发者ID:dfr0,项目名称:moon,代码行数:28,代码来源:Extensions.cs


示例17: PropertyValidationContext

        public PropertyValidationContext(object propertyOwner, DependencyProperty dependencyProperty)
        {
            if (propertyOwner == null)
                throw new ArgumentNullException("propertyOwner");

            this.propertyOwner = propertyOwner;
            this.propertyInfo = dependencyProperty;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:PropertyValidationContext.cs


示例18: DependencyPropertyRegistration

            public DependencyPropertyRegistration(FrameworkElement frameworkElement, DependencyProperty dependencyProperty, Action<object, object> propertyChangedCallback, object currentValue)
            {
                FrameworkElement = frameworkElement;
                DependencyProperty = dependencyProperty;
                PropertyChangedCallback = propertyChangedCallback;

                _currentValue = currentValue;
            }
开发者ID:RareNCool,项目名称:MyToolkit,代码行数:8,代码来源:DependencyPropertyChangedEvent.cs


示例19: UvmlDependencyPropertyBindingMutator

        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlDependencyPropertyBindingMutator"/> class.
        /// </summary>
        /// <param name="dpropID">The property which is being mutated.</param>
        /// <param name="dpropValue">The value to set on the property.</param>
        public UvmlDependencyPropertyBindingMutator(DependencyProperty dpropID, UvmlNode dpropValue)
        {
            Contract.Require(dpropID, nameof(dpropID));
            Contract.Require(dpropValue, nameof(dpropValue));

            this.dpropID = dpropID;
            this.dpropValue = dpropValue;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:13,代码来源:UvmlDependencyPropertyBindingMutator.cs


示例20: BindingTarget

 public BindingTarget()
 {
     PositionProperty = new DependencyProperty<Vector3>(
         new BindingFactory(),
         new Vector3(),
         PropertyChangedCallback,
         null);
 }
开发者ID:JackTheRipper42,项目名称:Binding,代码行数:8,代码来源:BindingTarget.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DependencyPropertyChangedEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# DependencyObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap