-
Notifications
You must be signed in to change notification settings - Fork 436
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
Problem with PasswordBox.Background #4
Comments
Actually the behavior of the PasswordBox is the intended behavior. Although the TextBox seems to work now, it's not intended and might break in future versions. If you try this in a UWP app, I would assume neither will work. The reason is that in hover and focused states the value of the <ui:SimpleStackPanel
Margin="12"
Spacing="24">
<ui:SimpleStackPanel.Resources>
<ImageBrush
x:Key="PasswordBackground"
ImageSource="/Images/login/key.png"
Stretch="None"
AlignmentY="Center"
AlignmentX="Left">
<ImageBrush.Transform>
<TranslateTransform X="10" />
</ImageBrush.Transform>
</ImageBrush>
</ui:SimpleStackPanel.Resources>
<PasswordBox
Width="200"
Padding="44,6,6,5"
HorizontalAlignment="Left"
ui:ControlHelper.PlaceholderText="Password"
Background="{StaticResource PasswordBackground}">
<PasswordBox.Resources>
<StaticResource x:Key="TextControlBackgroundPointerOver" ResourceKey="PasswordBackground" />
<StaticResource x:Key="TextControlBackgroundFocused" ResourceKey="PasswordBackground" />
</PasswordBox.Resources>
</PasswordBox>
</ui:SimpleStackPanel> Alternatively, it might be simpler to just overlay the image on top of the control like this: <Grid>
<PasswordBox
Width="200"
Padding="44,6,6,5"
HorizontalAlignment="Left"
ui:ControlHelper.PlaceholderText="Password" />
<Image
Source="/Images/login/key.png"
Stretch="None"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="10,0,0,0"
IsHitTestVisible="False" />
</Grid> |
I'm using the second way (overlay the image on top of the control) righnt now. Thanks. |
Hi, I mad a TextBox and a PasswordBox with background image. The TextBox seems nice, but the PasswordBox has some problem when hover or enter.
The text was updated successfully, but these errors were encountered: