Silverlight 工具包 - 带主题的 ChildWindow
从我发现的 silverlight 论坛页面来看,我的印象是在后面的代码中创建的 ChildWindow 会选取页面其余部分的主题;只有当您继承自ChildWindow时,情况就不再是这样了。
出于某种原因,尽管这不会发生在我身上。这是我的主题元素:
<wp:Theme x:Name="ThemeContainer" ThemeUri="/System.Windows.Controls.Theming.BubbleCreme;component/Theme.xaml">
这是我用来尝试创建 ChildWindow 的按钮的事件处理程序。弹出窗口,但没有应用任何主题:
private void Button_Click(object sender, RoutedEventArgs e) {
ChildWindow cw = new ChildWindow() { Height = 250, Width = 200 };
cw.Show();
}
有什么方法可以让它工作吗?
From a silverlight forum page I found, I was under the impression that a ChildWindow created in the code behind would pick up the theme of the rest of the page; it's only when you inherit from ChildWindow that this no longer is the case.
For some reason though this is not happening for me. Here is my theme element:
<wp:Theme x:Name="ThemeContainer" ThemeUri="/System.Windows.Controls.Theming.BubbleCreme;component/Theme.xaml">
And here's the event handler for a button that I'm using to try to create a ChildWindow. The window pops up, but does not have any theme applied:
private void Button_Click(object sender, RoutedEventArgs e) {
ChildWindow cw = new ChildWindow() { Height = 250, Width = 200 };
cw.Show();
}
Is there any way to get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在 App.xaml 中设置所需的全局主题并将其声明为应用程序的主题:
要动态设置应用程序主题,您可以尝试静态
You'll have to set your desired global theme in the App.xaml and declare it as the Application's theme:
To set the application theme dynamically, you can try the static