<a href="http://blog.csdn.net/taomanman/article/details/6777291"></a>
<a href="http://blog.csdn.net/taomanman/article/details/6777291">http://blog.csdn.net/taomanman/article/details/6777291</a>
1、建立一個資源檔案,比如: Gaugestyle.xaml和MenuButton.xaml
2、在App.xaml中添加該資源:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="spjl1.App">
<Application.Resources>
<!-- Resources scoped at the Application level should be defined here. -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Gaugestyle.xaml"/>
<ResourceDictionary Source="MenuButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
3、在頁面檔案背景中使用:
ResourceDictionary resources = new ResourceDictionary();
resources.Source = new Uri("/spjl1;component/MenuButton.xaml", System.UriKind.Relative);
RadWindow1.Style = resources["ChildWindowStyle1"] as Style;