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


C# ResourceDictionary.EndInit方法代码示例

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


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

示例1: Load

		private static ResourceDictionary Load(string filepath)
		{
			var dict = new ResourceDictionary();
			dict.BeginInit();
			dict.Source = new Uri(filepath, UriKind.RelativeOrAbsolute);
			dict.EndInit();
			return dict;
		}
开发者ID:cssack,项目名称:CsGlobals,代码行数:8,代码来源:Resource.Dictionary.cs

示例2: ApplyResourceDictionary

        private static void ApplyResourceDictionary(ResourceDictionary newRd, ResourceDictionary oldRd)
        {
            oldRd.BeginInit();

            foreach (DictionaryEntry r in newRd)
            {
                if (oldRd.Contains(r.Key))
                    oldRd.Remove(r.Key);

                oldRd.Add(r.Key, r.Value);
            }

            oldRd.EndInit();
        }
开发者ID:pdsullivan,项目名称:MahApps.Metro,代码行数:14,代码来源:ThemeManager.cs

示例3: LoadStyles

        private void LoadStyles(ResourceDictionary targetResources)
        {
            targetResources.BeginInit();
            // Basic resources
            targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/AppResources.xaml", UriKind.Relative) }));

            // Init all Converter that need a constructor
            var templateSelectorFactory = container.Resolve<Zetbox.Client.WPF.Toolkit.VisualTypeTemplateSelector.Factory>();
            targetResources["defaultTemplateSelector"] = templateSelectorFactory(null);
            targetResources["listItemTemplateSelector"] = templateSelectorFactory("Zetbox.App.GUI.SingleLineKind");
            targetResources["dashBoardTemplateSelector"] = templateSelectorFactory("Zetbox.App.GUI.DashboardKind");

            // Manually add DefaultStyles and DefaultViews to enable override through Autofac
            targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/Styles/DefaultStyles.xaml", UriKind.Relative) }));
            targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/Styles/DefaultHighlightColorDefinitions.xaml", UriKind.Relative) }));
            // Load registrated dictionaries from autofac
            foreach (var dict in container.Resolve<IEnumerable<Meta<ResourceDictionary>>>().Where(m => WPFHelper.RESOURCE_DICTIONARY_STYLE.Equals(m.Metadata[WPFHelper.RESOURCE_DICTIONARY_KIND])).Select(m => m.Value))
            {
                targetResources.MergedDictionaries.Add(Freeze(dict));
            }

            // For testing only!!!!
            // targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/Styles/BigFontStyles.xaml", UriKind.Relative) }));

            targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/Styles/DefaultViews.xaml", UriKind.Relative) }));
            targetResources.MergedDictionaries.Add(Freeze(new ResourceDictionary() { Source = new Uri("/Zetbox.Client.WPF;component/Styles/CustomControls.xaml", UriKind.Relative) }));
            // Load registrated dictionaries from autofac
            foreach (var dict in container.Resolve<IEnumerable<Meta<ResourceDictionary>>>().Where(m => WPFHelper.RESOURCE_DICTIONARY_VIEW.Equals(m.Metadata[WPFHelper.RESOURCE_DICTIONARY_KIND])).Select(m => m.Value))
            {
                targetResources.MergedDictionaries.Add(Freeze(dict));
            }

            targetResources.EndInit();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:34,代码来源:App.cs


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