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


C# DependencyObject.ProvideSelfAsInheritanceContext方法代码示例

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


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

示例1: ProvideContextForObject

 [FriendAccessAllowed] // Built into Core, also used by Framework.
 internal static void ProvideContextForObject(
     DependencyObject context,
     DependencyObject newValue )
 {
     if (context != null)
     {
         context.ProvideSelfAsInheritanceContext(newValue, null);
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:10,代码来源:InheritanceContextHelper.cs

示例2: AddInheritanceContext

 // add inheritance context to a value
 private void AddInheritanceContext(DependencyObject inheritanceContext, object value)
 {
     // The VisualBrush.Visual property is the "friendliest", i.e. the
     // most likely to be accepted by the resource as FEs need to accept
     // being rooted by a VisualBrush.
     //
     // NOTE:  Freezable.Debug_VerifyContextIsValid() contains a special
     //        case to allow this with the VisualBrush.Visual property.
     //        Changes made here will require updates in Freezable.cs
     if (inheritanceContext.ProvideSelfAsInheritanceContext(value, VisualBrush.VisualProperty))
     {
         // if the assignment was successful, seal the value's InheritanceContext.
         // This makes sure the resource always gets inheritance-related information
         // from its point of definition, not from its point of use.
         DependencyObject doValue = value as DependencyObject;
         if (doValue != null)
         {
             doValue.IsInheritanceContextSealed = true;
         }
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:22,代码来源:ResourceDictionary.cs


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