如何写自己的控件模块 HeBianGu.Control.MyControl ├─ MyControl.xaml ├─ MyControl.xaml.cs ├─ Themes │ └─ Generic.xaml ├─ Service.cs ├─ Extention.cs └─ AssemblyInfo.cs20.1 控件本体MyControl.xaml写界面布局。MyControl.xaml.cs写依赖属性和交互逻辑。20.2 默认样式Themes/Generic.xaml写控件默认样式。20.3 服务注册如果控件需要服务就在Service.cs中定义服务在Extention.cs中提供扩展注册方法。示例publicstaticclassExtention{publicstaticvoidAddMyControl(thisIServiceCollectionservices){services.AddSingletonIMyControlService,MyControlService();}}应用中调用services.AddMyControl();这就是本项目大量模块的组织套路。