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


C# DependencyObject.InvalidateProperty方法代码示例

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


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

示例1: OnIsHiddenPropertyChanged

		static void OnIsHiddenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			var dpd = DependencyPropertyDescriptor.FromProperty(UIElement.VisibilityProperty, d.GetType());
			
			if ((bool)e.NewValue) {
				EnsureHidden(d);
				dpd.AddValueChanged(d, OnVisibilityPropertyChanged);
			} else {
				dpd.RemoveValueChanged(d, OnVisibilityPropertyChanged);
				d.InvalidateProperty(UIElement.VisibilityProperty);
			}
		}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:12,代码来源:DesignTimeProperties.cs

示例2: InvalidateResourceDependentsForChild

        //
        //  This method
        //  1. Invalidates all the resource references set on a template for a given child.
        //  2. Returns true if any were found
        //
        internal static void InvalidateResourceDependentsForChild(
                DependencyObject                            container,
                DependencyObject                            child,
                int                                         childIndex,
                ResourcesChangeInfo                         info,
                FrameworkTemplate                           parentTemplate)
        {
            FrugalStructList<ChildPropertyDependent> resourceDependents = parentTemplate.ResourceDependents;
            int count = resourceDependents.Count;

            // Invalidate all properties on the given child that
            // are being driven via a resource reference in a template
            for (int i = 0; i < count; i++)
            {
                if (resourceDependents[i].ChildIndex == childIndex &&
                    info.Contains(resourceDependents[i].Name, false /*isImplicitStyleKey*/))
                {
                    DependencyProperty dp = resourceDependents[i].Property;
                    // Update property on child
                    child.InvalidateProperty(dp);

                    // skip remaining dependents for the same property - we only
                    // need to invalidate once.  The list is sorted, so we just need
                    // to skip until we find a new property.
                    int dpIndex = dp.GlobalIndex;
                    while (++i < resourceDependents.Count)
                    {
                        if (resourceDependents[i].ChildIndex != childIndex ||
                            resourceDependents[i].Property.GlobalIndex != dpIndex)
                        {
                            break;
                        }
                    }
                    --i;    // back up to let the for-loop do its normal increment
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:42,代码来源:StyleHelper.cs

示例3: InvalidateContainerDependents

         //
        //  This method
        //  1. Invalidates all the properties set on the container's style.
        //     The value could have been set directly on the Style or via Trigger.
        //
        internal static void InvalidateContainerDependents(
            DependencyObject                         container,
            ref FrugalStructList<ContainerDependent> exclusionContainerDependents,
            ref FrugalStructList<ContainerDependent> oldContainerDependents,
            ref FrugalStructList<ContainerDependent> newContainerDependents)
        {
            // Invalidate all properties on the container that were being driven via the oldStyle
            int count = oldContainerDependents.Count;
            for (int i = 0; i < count; i++)
            {
                DependencyProperty dp = oldContainerDependents[i].Property;

                // Invalidate the property only if it is not locally set
                if (!IsSetOnContainer(dp, ref exclusionContainerDependents, false /*alsoFromTriggers*/))
                {
                    // call GetValueCore to get value from Style/Template
                    container.InvalidateProperty(dp);
                }
            }

            // Invalidate all properties on the container that will be driven via the newStyle
            count = newContainerDependents.Count;
            if (count > 0)
            {
                FrameworkObject fo = new FrameworkObject(container);

                for (int i = 0; i < count; i++)
                {
                    DependencyProperty dp = newContainerDependents[i].Property;

                    // Invalidate the property only if it
                    // - is not a part of oldContainerDependents and
                    // - is not locally set
                    if (!IsSetOnContainer(dp, ref exclusionContainerDependents, false /*alsoFromTriggers*/) &&
                        !IsSetOnContainer(dp, ref oldContainerDependents, false /*alsoFromTriggers*/))
                    {
                        ApplyStyleOrTemplateValue(fo, dp);
                    }
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:46,代码来源:StyleHelper.cs


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