Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PasswordBox Corner Radius #3582

Closed
ghost opened this issue Aug 26, 2019 · 3 comments · Fixed by #3627
Closed

PasswordBox Corner Radius #3582

ghost opened this issue Aug 26, 2019 · 3 comments · Fixed by #3627
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Aug 26, 2019

I've successfully set the corner radius on textboxes, but I'm struggling to do the same on a password box. It just doesn't have any effect.

Here is part of my app.xaml

The background change works, but not the border.

Any help appreciated, thanks!

<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> </ResourceDictionary.MergedDictionaries> <!--override MahApps theme / controls--> <Style TargetType="{x:Type TextBox}"> <Style.Resources> <Style TargetType="{x:Type Border}"> <Setter Property="CornerRadius" Value="4" /> </Style> </Style.Resources> </Style> <Style TargetType="{x:Type PasswordBox}"> <Setter Property="Background" Value="LightGreen" /> <Style.Resources> <Style TargetType="{x:Type Border}"> <Setter Property="CornerRadius" Value="4" /> </Style> </Style.Resources> </Style>

@timunie
Copy link
Collaborator

timunie commented Aug 27, 2019

@Jacquers I had a look in the template and it is a bug there. There is nothing you can do right now (if you do not want to reimplement the style.) I think we will have a fix for this issue soon.

Happy coding
Tim

@ghost
Copy link
Author

ghost commented Aug 27, 2019

Thanks, much appreciated.

In the mean time I've found a workaround using this: https://codereview.stackexchange.com/questions/197042/rounded-borders-for-different-controls-button-textbox-combobox-via-attached

But had to change some code:

// setting borders for non-combobox controls
Border border = control.Template.FindName("border", control) as Border;

to

// setting borders for non-combobox controls
Border border = control.Template.FindName("Base", control) as Border;

@amkuchta
Copy link
Contributor

@timunie @punker76 it might be work looking at all of the controls to see where CornerRadius can be implemented. For example, DataGrid, CheckBox, Expander (<= requires some magic depending on whether IsExpanded is true or false) etc. I've been rolling my own templates to handle rounded corners, but making this more easily available would definitely be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants