简体   繁体   English

在winui中创建自定义控件库的正确方法

[英]Right way to create a custom control library in winui

i want to create a custom control library with winui 3/uwp.我想用 winui 3/uwp 创建一个自定义控件库。

The question is How should I introduce dictionaries and styles?问题是我应该如何引入字典和样式?

Why did PowerToys put some dictionaries in the generic file ?为什么 PowerToys 将一些字典放在通用文件中 And put some other dictionaries in the app.xaml file?并在app.xaml文件中放入一些其他词典?

I also noticed that one of the dictionaries (IsEnabledTextBlock) was placed in both the generic file and the app.xaml file.我还注意到其中一个词典 (IsEnabledTextBlock) 被放置在通用文件和app.xaml文件中。 why?为什么?

If we want to create a custom control library, how should we introduce these dictionaries and styles?如果我们要创建自定义控件库,应该如何引入这些字典和样式?

If you are developing a library that contains custom controls, the default styles of these controls should be defined in a resource dictionary called themes/generic.xaml .如果您正在开发包含自定义控件的库,则应在名为themes/generic.xaml的资源字典中定义这些控件的默认样式。 This is where the framework will look for them by convention.这是框架将按照约定查找它们的地方。

A class library has no concept of an app global App.xaml file since it's not an app.类库没有应用全局App.xaml文件的概念,因为它不是应用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM