wpf icon indicating copy to clipboard operation
wpf copied to clipboard

Rounded Corners

Open singhashish-wpf opened this issue 2 years ago • 1 comments

Description

As on now, most of the controls where CornerRadius is needed, we have set the default value that's defined in Fluent theme styles by using Border.CornerRadius property in style, however this is not customizable and developers cannot set is as follows :

<!-- this does not work -->
<Button Border.CornerRadius="8">...</Button>

The only way that can be used right now is as follows :

<Style x:Key="CustomButtonStyle" BasedOn="{StaticResource DefaultButtonStyle}" TargetType="Button">
    <Setter Property="Border.CornerRadius" Value="8" />
</Style>

<Button Style="{StaticResource CustomButtonStyle}" />

This will make it tougher for developers to customize corner radius. Here are the next steps / work items that need to be done regarding this task.

Primary Tasks

  • [x] Prioritize controls where rounded corners add more visual value
  • [ ] Finalize a way to allow customizing CornerRadius for controls other than Border

Secondary Tasks

  • [ ] Write performance measurement benchmark for rounded corners.
  • [ ] For container controls - Check performance impact.

Notes:

  • CornerRadius Property and Converter already existing for wpf.
  • For button and some other controls this property is not Present in the backing cs file. We might need to add this property to those controls. [API Change]
  • We might not want to have CornerRadius property in all the xaml file with the same values to avoid duplication.
  • We can have a list of variables, which contains the cornerradius values, and we can set CornerRadius property with this value as a DynamicResource.
  • Performance needs to be assessed per control and multiple controls on the same window and for different categories of controls like container controls, nested controls.

Open Questions:

  • Clarify what happens when the Dev overrides the cornerRadius attribute in the app?

singhashish-wpf avatar Dec 14 '23 10:12 singhashish-wpf

Also see the discussion: #9450

My proposal (if you don't add the CornerRadius property to each control that needs it) is to use an attached property like ModernWPF.

robert-abeo avatar Jan 29 '25 16:01 robert-abeo