WPF,多个控件的字体样式
好吧,我可能会错过一些非常简单的东西,但我想对多个控件使用相同的字体系列、字体大小和颜色。
有没有办法为此创建一种样式并应用不同的控件?
抱歉,如果之前有人问过这个问题。 谢谢
ok, I might be missing something really easy, But I want to use the same Font family, Font Size, and color for multiple controls.
Is there a way to create one style for this and apply it different controls?
Sorry if this has been asked before.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
控件都在同一个容器中吗?例如,在同一个
Window
或StackPanel
中?如果是这样,您可以在父容器上设置这些属性,它们将应用于所有子容器。例如:如果您想在整个应用程序中标准化字体,您可以在 App.xaml 文件中使用隐式样式,如下所示:
Are the controls all in the same container? For example, in the same
Window
orStackPanel
? If so, you can make set those properties on the parent container and they'll apply to any children. For example:If you want to standardize the font across your entire app, you can use an implict style in your App.xaml file, like this:
我想为新手(比如我自己)添加这个。
如果要为容器中的多个项目设置属性:
您可以在控件的“资源”中设置“样式”,如下所示:
I wanted to add this for the newbies (like myself).
If you want to set a property for multiple items within a container:
You can set a "style" within the "resources" for a control like so: