引用 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 + "\"/>"); }
时间: 2024-10-24 12:36:26