本文整理汇总了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);
}
}
示例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;
}
}
}