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

[Enhancement] Allow to change the Reveal Icon in the PasswordBox #3105

Closed
gigios opened this Issue Nov 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@gigios

gigios commented Nov 17, 2017

I searched in the repository if was present a solution on my problem.
I want to change the 'default' Reveal icon used in the PasswordBox with the 'standard' icon used in Windows 10.
From: immagine
To: immagine

It's clear that I can replace the PasswordBox style with a my custom style but, probably, the best solution could be the implementation of a new attached property in the PasswordBoxHelper in the similar way of the CapsLockIcon property.

Do you think that could be a good solution?

Thanks for the support

@punker76

This comment has been minimized.

Member

punker76 commented Nov 17, 2017

@gigios I will changed this

Style="{StaticResource RevealButtonStyle}"

to DynamicResource, then you can override it with your own style.

<!-- Button Style for Win8MetroPasswordBox -->
<Style x:Key="RevealButtonStyle"
BasedOn="{StaticResource ChromelessButtonStyle}"
TargetType="{x:Type ButtonBase}">
<Setter Property="Margin" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<Grid Background="{TemplateBinding Background}">
<!-- Material - Eye -->
<ContentControl x:Name="PART_PackIcon"
Width="{TemplateBinding Controls:TextBoxHelper.ButtonWidth}"
Height="{TemplateBinding Controls:TextBoxHelper.ButtonWidth}"
Padding="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"
Style="{DynamicResource PathIconContentControlStyle}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_PackIcon" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter TargetName="PART_PackIcon" Property="Opacity" Value=".5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

@punker76 punker76 added this to the 1.6.0 milestone Nov 17, 2017

@punker76 punker76 self-assigned this Nov 17, 2017

@gigios

This comment has been minimized.

gigios commented Nov 17, 2017

Ok! Thanks
In this way it's possible override a small portion of the 'original' style.

punker76 added a commit that referenced this issue Dec 11, 2017

(#3105) Allow to change the RevealButton Icon in the PasswordBox
  Add 2 new attached properties RevealButtonContent and RevealButtonContentTemplate
  Set the DefaultRevealButtonIcon to RevealButtonContent

punker76 added a commit that referenced this issue Dec 11, 2017

Merge pull request #3122 from MahApps/feature/3105_Change_RevealButto…
…n_Content

(#3105) Allow to change the RevealButton Icon in the PasswordBox

punker76 added a commit that referenced this issue Dec 13, 2017

(#3105) Allow to change the RevealButton Icon in the PasswordBox
  Add 2 new attached properties RevealButtonContent and RevealButtonContentTemplate
  Set the DefaultRevealButtonIcon to RevealButtonContent

punker76 added a commit that referenced this issue Dec 13, 2017

Merge pull request #3122 from MahApps/feature/3105_Change_RevealButto…
…n_Content

(#3105) Allow to change the RevealButton Icon in the PasswordBox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment