开发者

C#/WPF: How do I separate structure from styles like in web programming?

开发者 https://www.devze.com 2022-12-17 10:34 出处:网络
When programming for the web, you normally separate stru开发者_运维技巧cture from style using a separation of HTML and CSS.

When programming for the web, you normally separate stru开发者_运维技巧cture from style using a separation of HTML and CSS.

How do I accomplish the same in a WPF project? All the examples I find use "inline" styling. Is it possible at all? Does it even make any sense in WPF?


You can pull out all styles into separate XAML files and only reference them from the XAML files that define your UI structure. ResourceDictionarys are your friend here.

Actually that's both common and recommended in WPF.

0

精彩评论

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