MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit
Use global SystemParameters.FocusVisualStyleKey insead of per control FocusVisual style
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 16.3k
- 派生
- 3.5k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 8
描述
Is your feature request related to a problem? Please describe.
A bunch of control styles define a FocusVisual style that is used as a setter value for FocusVisualStyle property and there is no way to customize them other than creating custom styles for each control and setting FocusVisualStyle to your own style.
Most of them are identical:
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/2a38b2c70a5e851bc5b926e0641c1848e719d86b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Button.xaml#L17-L30
Only OptionMarkFocusVisual seems to have different Margin:
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/2a38b2c70a5e851bc5b926e0641c1848e719d86b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml#L13-L25
I think the FocusVisualStyle should be globally defined with SystemParameters.FocusVisualStyleKey in App.xaml:
<Style x:Key="{x:Static SystemParameters.FocusVisualStyleKey}" TargetType="Control">
<Setter Property="Control.Template">
...
</Setter>
</Style>
If Margin is all that needs to be changed for some controls then maybe a FocusVisualAssist.Margin could be added to allow those controls to have their own FocusVisualStyle:
<Style x:Key="OptionMarkFocusVisual" BasedOn="{x:Static SystemParameters.FocusVisualStyleKey}">
<Setter Property="materialDesign:FocusVisualAssist.Margin" Value="0,0,0,0"/>
</Style>
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从 MaterialDesignTheme.Button.xaml 和 MaterialDesignTheme.RadioButton.xaml 中的 FocusVisual 定义开始,然后检查 App.xaml 中对 SystemParameters.FocusVisualStyleKey 的拟议使用方式。比较共享模板和不同的 OptionMark 边距,并考虑现有的 FocusVisualAssist 路径。在不改变焦点呈现的情况下替换或合并按控件重复的样式,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- design, desktop
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100