码迷,mamicode.com
首页 > Windows程序 > 详细

Infragistics WPF 应用主题到所有控件

时间:2016-05-06 00:23:41      阅读:807      评论:0      收藏:0      [点我收藏+]

标签:

引用 Infragistics.Themes.MetroDarkTheme.dll (本文以MetroDarkTheme为例)

并在 App.xaml 中添加:

<Application x:Class="MetroDarkThemeTest.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:MetroDarkThemeTest"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.DataVisualization.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.OlapCharts.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.WPF.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamCalendar.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamColorPicker.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamComboEditor.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDataChart.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDataPresenter.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDataTree.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDateTimeInput.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDiagram.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDialogWindow.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamDockManager.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamEditors.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamFormulaEditor.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGantt.ContextMenuIcons.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGantt.TaskModeIcons.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGantt.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGauges.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGeographicMap.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamGrid.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamMap.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamMaskedInput.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamMenu.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamMultiColumnCombo.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamNetworkNode.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamOrgChart.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamOutlookBar.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamPivotDataSlicer.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamPivotGrid.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamPropertyGrid.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamRadialMenu.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamRibbon.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamRichTextEditor.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSchedule.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSlider.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSparkline.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSpellChecker.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSpreadsheet.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSpreadsheetContextMenuResourceSet.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamSyntaxEditor.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamTagCloud.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamTileManager.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamTimeline.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/MetroDark.xamTreemap.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/Styles.Shared.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/Styles.WPF.xaml"/>
                <ResourceDictionary Source="/Infragistics.Themes.MetroDarkTheme;component/Theme.Colors.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Infragistics.Themes.MetroDarkTheme.dll 的来源:

安装 Infragistics_WPF_20151_Samples.msi 后
C:\Users\Public\Documents\Infragistics\2015.1\WPF\Samples\CLR4.0\Infragistics.Themes\MetroDarkTheme.WPF\Infragistics.Themes.MetroDarkTheme.WPF.csproj
Release生成

 

ResourceDictionary 的提取:

            DirectoryInfo dir = new DirectoryInfo(@"C:\Users\Public\Documents\Infragistics\2015.1\WPF\Samples\CLR4.0\Infragistics.Themes\MetroDarkTheme.WPF");
            FileInfo[] files = dir.GetFiles("*.xaml");
            foreach (FileInfo f in files)
            {
                Console.WriteLine("<ResourceDictionary Source=\"/Infragistics.Themes.MetroDarkTheme;component/" + f.Name + "\"/>");
            }

 

Infragistics WPF 应用主题到所有控件

标签:

原文地址:http://www.cnblogs.com/52zmj/p/5463608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!