Skip to content

Instantly share code, notes, and snippets.

@GioviQ
Created February 9, 2022 08:25
Show Gist options
  • Save GioviQ/3a366e3eb55f6411b6f41deb146c35b9 to your computer and use it in GitHub Desktop.
Save GioviQ/3a366e3eb55f6411b6f41deb146c35b9 to your computer and use it in GitHub Desktop.
<Style TargetType="TextBox" x:Key="MaterialDesignFloatingHintTextBoxWithFocus" BasedOn="{StaticResource MaterialDesignFloatingHintTextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsVisible}" Value="True">
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="PasswordBox" x:Key="PasswordBoxWithFocus" BasedOn="{StaticResource MaterialDesignPasswordBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsVisible}" Value="True">
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment