MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit
Use global SystemParameters.FocusVisualStyleKey insead of per control FocusVisual style
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 16.3k
- Forks
- 3.5k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 8
Description
**Is your feature request related to a problem? Please describe.**
A [bunch](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/search?q=FocusVisual) 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:
```xaml
<Setter Property="Control.Template">
...
</Setter>
```
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`:
```xaml
<Setter Property="materialDesign:FocusVisualAssist.Margin" Value="0,0,0,0"/>
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FocusVisual definitions in MaterialDesignTheme.Button.xaml and MaterialDesignTheme.RadioButton.xaml, then inspect the proposed App.xaml use of SystemParameters.FocusVisualStyleKey. Compare the shared template and the differing OptionMark margin, and consider the existing FocusVisualAssist path. Done means the duplicated per-control styles are replaced or consolidated without changing focus rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- design, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100