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


C# ResourceDictionary.AddOwner方法代码示例

本文整理汇总了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);
                }
            } 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:64,代码来源:ResourceDictionary.cs


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