本文整理汇总了C#中System.Windows.ResourceDictionary.AddOwner方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceDictionary.AddOwner方法的具体用法?C# ResourceDictionary.AddOwner怎么用?C# ResourceDictionary.AddOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.ResourceDictionary
的用法示例。
在下文中一共展示了ResourceDictionary.AddOwner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropagateParentOwners
/// <summary>
/// This sends down the owners of this ResourceDictionary into the given
/// merged dictionary. We do this because whenever a merged dictionary
/// changes it should invalidate all owners of its parent ResourceDictionary.
///
/// Note that AddOwners throw if the merged dictionary already has one of the
/// parent's owners. This implies that either we're putting a dictionary
/// into its own MergedDictionaries collection or we're putting the same
/// dictionary into the collection twice, neither of which are legal.
/// </summary>
/// <param name="mergedDictionary"></param>
private void PropagateParentOwners(ResourceDictionary mergedDictionary)
{
if (_ownerFEs != null)
{
Invariant.Assert(_ownerFEs.Count > 0);
if (mergedDictionary._ownerFEs == null)
{
mergedDictionary._ownerFEs = new WeakReferenceList(_ownerFEs.Count);
}
foreach (object o in _ownerFEs)
{
FrameworkElement fe = o as FrameworkElement;
if (fe != null)
mergedDictionary.AddOwner(fe);
}
}
if (_ownerFCEs != null)
{
Invariant.Assert(_ownerFCEs.Count > 0);
if (mergedDictionary._ownerFCEs == null)
{
mergedDictionary._ownerFCEs = new WeakReferenceList(_ownerFCEs.Count);
}
foreach (object o in _ownerFCEs)
{
FrameworkContentElement fce = o as FrameworkContentElement;
if (fce != null)
mergedDictionary.AddOwner(fce);
}
}
if (_ownerApps != null)
{
Invariant.Assert(_ownerApps.Count > 0);
if (mergedDictionary._ownerApps == null)
{
mergedDictionary._ownerApps = new WeakReferenceList(_ownerApps.Count);
}
foreach (object o in _ownerApps)
{
Application app = o as Application;
if (app != null)
mergedDictionary.AddOwner(app);
}
}
}