开发者

Setting a theme in WPF

I have a relativly 开发者_JS百科simple question that I can't seem to figure out. I have downloaded some theme files in an XAML format off the internet and I would like to use them as my themes in my WPF application. How do you do this? All help is appreciated!


Add the theme.xaml file to your project(right click->Add Existing Item...). Then in your App.xaml file add the following code

<Application.Resources>
<ResourceDictionary Source="ThemeFile.xaml" />
</Application.Resources>

Replacing ThemeFile.xaml with the name of the theme file you wish to use.


You can put the elements in App.xaml, and they'll automatically trickle down. This can either be done directly (copy and paste), or via a merged resource dictionary, where app.xaml just references the .xaml file(s) of your theme.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜