This commit is contained in:
1 parent
72d9b295a0
commit
5d81c475c8
335 files changed
+7359
No files matched your search
@@ -0,0 +1,19 @@
|
||||
# 原生 WPF 控件样式
|
||||
|
||||
这里处理 `System.Windows.Controls` 的原生类型。需要扩展控件功能时才选 `HandyControl.Controls` 下的类型。先按实际 CLR 类型选择样式,不能将一个同名扩展类型的样式套在原生类型上。
|
||||
|
||||
```xml
|
||||
<StackPanel>
|
||||
<Button Content="保存" Style="{StaticResource ButtonPrimary}"
|
||||
Command="{Binding SaveCommand}"/>
|
||||
<TextBox Margin="0,12,0,0" Style="{StaticResource TextBoxExtend}"
|
||||
hc:InfoElement.Title="用户名" hc:InfoElement.Placeholder="请输入用户名"
|
||||
Text="{Binding UserName, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</StackPanel>
|
||||
```
|
||||
|
||||
片段依赖 App.xaml 的皮肤和主题字典、hc 命名空间,以及使用方 DataContext。原生 PasswordBox 不提供可直接按 TextBox 方式绑定的 Text 属性;需要密码绑定时按实际控件方案实现。
|
||||
|
||||
附加属性来自 `Controls/Attach`:检查 InfoElement、TitleElement、BorderElement、IconElement 等的 Get/Set 方法和对应模板的使用位置。设置附加属性不代表任意模板都会展示它。
|
||||
|
||||
下面的显式 Style 键从本仓库各原生控件样式源文件生成;不是所有键都适用于控件本身(例如某些键针对子元素),使用前在源文件核对 TargetType。隐式样式和 BasedOn 链不在本清单展开。
|
||||
Reference in new issue
Block a user