[英]How to create a separate file for styles in Avalonia?
I'm new to xaml and I saw the Avalonia framework and I really like it.我是 xaml 的新手,我看到了 Avalonia 框架,我非常喜欢它。 but when I start some coding I want to make styles available in multiple files and since the official docs doesn't help, is there someone who can tell me how can I separate the styles and put them in a file?
但是当我开始一些编码时,我想让 styles 在多个文件中可用,并且由于官方文档没有帮助,有没有人可以告诉我如何分离 styles 并将它们放入文件中?
Just place your styles in a separate file and use <StyleInclude Source="/YourStyles.xaml">
只需将您的 styles 放在单独的文件中并使用
<StyleInclude Source="/YourStyles.xaml">
See https://github.com/AvaloniaUI/ControlCatalogStandalone/blob/b6fe246293cde40a82ab57b56f1db2ce52ebe98d/ControlCatalog/App.xaml#L18 and https://github.com/AvaloniaUI/ControlCatalogStandalone/blob/b6fe246293cde40a82ab57b56f1db2ce52ebe98d/ControlCatalog/SideBar.xaml for example. See https://github.com/AvaloniaUI/ControlCatalogStandalone/blob/b6fe246293cde40a82ab57b56f1db2ce52ebe98d/ControlCatalog/App.xaml#L18 and https://github.com/AvaloniaUI/ControlCatalogStandalone/blob/b6fe246293cde40a82ab57b56f1db2ce52ebe98d/ControlCatalog/SideBar.xaml for example.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.