【发布时间】:2015-05-15 11:15:16
【问题描述】:
我在 WPF 中遇到了 Telerik 主题的一些问题 我添加了对 Telerik.Windows.Themes.Windows8 的引用,并使用文件 App.xaml 将资源与以下代码合并:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/telerik.windows.controls.docking.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
现在我想将 Windows 8 样式应用到我的主窗口,所以我将其更改为 telerik:RadWindow
<telerik:RadWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
x:Class="Foo.MainWindow"
Header="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="37,79,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<telerik:RadSlider HorizontalAlignment="Left" Margin="273,156,0,0" VerticalAlignment="Top" Width="200"/>
<telerik:RadButton Content="Button" HorizontalAlignment="Left" Height="Auto" Margin="158,232,0,0" VerticalAlignment="Top" Width="Auto" Click="ButtonBase_OnClick"/>
</Grid>
</telerik:RadWindow>
在设计器中应用了主题并且看起来一切正常: 但是当我启动应用程序时,它看起来完全不同:
我不知道为什么会发生此错误。 如果我使用代码创建一个 RadWindow,它会完美运行:
RadWindow w = new RadWindow();
w.Width = 500;
w.Height = 500;
w.Show();
【问题讨论】: