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


C# DependencyProperty类代码示例

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


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


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