# wpf开发系列 # nuget工具篇 ### nuget包工具命令 ``` //删除包 dotnet nuget delete -s https://nuget.lingyanspace.com/v3/index.json LingYanAutoUpdate 1.0.0 -k nugetlingyanspace --non-interactive ``` # 打包篇 ## inno ### 中文环境【ChineseSimplified.isl】 [ChineseSimplified.isl](https://book.lingyanspace.com/attachments/2) ### isl环境中文 ``` Name: "english"; MessagesFile: "compiler:Default.isl" Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl" ``` # 基础篇 ### 依赖属性propdb ```c# public int MyProperty { get { return (int)GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value); } } // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0)); ``` ### 附加属性propa ```c# public static int GetMyProperty(DependencyObject obj) { return (int)obj.GetValue(MyPropertyProperty); } public static void SetMyProperty(DependencyObject obj, int value) { obj.SetValue(MyPropertyProperty, value); } // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.RegisterAttached("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0)); ``` ## xaml资源键类型
定义方式优点缺点适用场景
**普通字符串键**简单直观,易于使用命名冲突风险,无法跨程序集共享小型项目,局部资源
**类型键**自动应用,无需显式引用灵活性较低全局样式,基础样式复用
**静态资源键**强类型支持,可维护性高定义稍复杂大型项目,组件化开发
**`ComponentResourceKey`**跨程序集支持,语义化标识定义和使用复杂组件库开发,主题或样式库
**动态资源键**动态绑定,灵活性高性能开销主题切换,多语言支持
```nginx //普通字符串键 //静态资源键 public static class ResourceKeys { public static readonly string CloseButtonStyle = "CloseButtonStyle"; }