Files
Speckle.Material.Avalonia/Material.Styles/TextBox.xaml
T
2021-01-06 08:49:43 +09:00

580 lines
32 KiB
XML

<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animations="clr-namespace:Material.Styles.Additional.Animations"
xmlns:styles="clr-namespace:Material.Styles">
<Styles.Resources>
<StreamGeometry x:Key="TextBoxClearButtonData">M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxRevealButtonData">M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxHideButtonData">M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z</StreamGeometry>
<StreamGeometry x:Key="MaterialContentCut" >M19 3L13 9L15 11L22 4V3M12 12.5A0.5 0.5 0 0 1 11.5 12A0.5 0.5 0 0 1 12 11.5A0.5 0.5 0 0 1 12.5 12A0.5 0.5 0 0 1 12 12.5M6 20A2 2 0 0 1 4 18C4 16.89 4.9 16 6 16A2 2 0 0 1 8 18C8 19.11 7.1 20 6 20M6 8A2 2 0 0 1 4 6C4 4.89 4.9 4 6 4A2 2 0 0 1 8 6C8 7.11 7.1 8 6 8M9.64 7.64C9.87 7.14 10 6.59 10 6A4 4 0 0 0 6 2A4 4 0 0 0 2 6A4 4 0 0 0 6 10C6.59 10 7.14 9.87 7.64 9.64L10 12L7.64 14.36C7.14 14.13 6.59 14 6 14A4 4 0 0 0 2 18A4 4 0 0 0 6 22A4 4 0 0 0 10 18C10 17.41 9.87 16.86 9.64 16.36L12 14L19 21H22V20L9.64 7.64Z</StreamGeometry>
<StreamGeometry x:Key="MaterialContentCopy" >M19 21H8V7H19M19 5H8A2 2 0 0 0 6 7V21A2 2 0 0 0 8 23H19A2 2 0 0 0 21 21V7A2 2 0 0 0 19 5M16 1H4A2 2 0 0 0 2 3V17H4V3H16V1Z</StreamGeometry>
<StreamGeometry x:Key="MaterialContentPaste" >M19 20H5V4H7V7H17V4H19M12 2A1 1 0 0 1 13 3A1 1 0 0 1 12 4A1 1 0 0 1 11 3A1 1 0 0 1 12 2M19 2H14.82C14.4 0.84 13.3 0 12 0C10.7 0 9.6 0.84 9.18 2H5A2 2 0 0 0 3 4V20A2 2 0 0 0 5 22H19A2 2 0 0 0 21 20V4A2 2 0 0 0 19 2Z</StreamGeometry>
<StreamGeometry x:Key="MaterialSelectAll">M9 9H15V15H9M7 17H17V7H7M15 5H17V3H15M15 21H17V19H15M19 17H21V15H19M19 9H21V7H19M19 21A2 2 0 0 0 21 19H19M19 13H21V11H19M11 21H13V19H11M9 3H7V5H9M3 17H5V15H3M5 21V19H3A2 2 0 0 0 5 21M19 3V5H21A2 2 0 0 0 19 3M13 3H11V5H13M3 9H5V7H3M7 21H9V19H7M3 13H5V11H3M3 5H5V3A2 2 0 0 0 3 5Z</StreamGeometry>
<ContextMenu x:Key="DefaultTextBoxContextMenu" x:Name="TextBoxContextMenu" WindowManagerAddShadowHint="False">
<MenuItem x:Name="TextBoxContextMenuCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}"
IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" >
<MenuItem.Icon>
<Path Data="{StaticResource MaterialContentCut}" Fill="{DynamicResource MaterialDesignBody}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="TextBoxContextMenuCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}"
IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}" >
<MenuItem.Icon>
<Path Data="{StaticResource MaterialContentCopy}" Fill="{DynamicResource MaterialDesignBody}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="TextBoxContextMenuPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}"
IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}" >
<MenuItem.Icon>
<Path Data="{StaticResource MaterialContentPaste}" Fill="{DynamicResource MaterialDesignBody}"/>
</MenuItem.Icon>
</MenuItem>
<Separator/>
<MenuItem x:Name="TextBoxContextMenuSelectAllItem" Header="Select All" Command="{Binding $parent[TextBox].SelectAll}">
<MenuItem.Icon>
<Path Data="{StaticResource MaterialSelectAll}" Fill="{DynamicResource MaterialDesignBody}"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Styles.Resources>
<!-- Standard TextBox style -->
<Style Selector="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="SelectionBrush" Value="{DynamicResource MaterialDesignSelection}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource PrimaryHueMidForegroundBrush}" />
<Setter Property="Padding" Value="0,8" />
<Setter Property="ContextMenu" Value="{StaticResource DefaultTextBoxContextMenu}" />
<Setter Property="CaretBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}"></Setter>
<Setter Property="FontFamily" Value="avares://Material.Styles/Fonts/Roboto#Roboto"/>
<Setter Property="Template">
<ControlTemplate>
<StackPanel>
<Border Name="border"
Cursor="Ibeam"
MinHeight="48"
CornerRadius="8,8,0,0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border.Styles>
<Style Selector="Border:disabled, TextBlock:disabled">
<Setter Property="Opacity" Value="0.5" />
</Style>
</Border.Styles>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border Name="focusBorder"
CornerRadius="8,8,0,0"
Background="{TemplateBinding Background}" />
<TextBlock Name="floatingWatermark"
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
Classes="Subtitle1"
Foreground="{DynamicResource ThemeAccentBrush}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{DynamicResource FontSizeSmall}"
Text="{TemplateBinding Watermark}"
RenderTransformOrigin="0, 0"
IsVisible="{TemplateBinding UseFloatingWatermark}">
<TextBlock.Styles>
<Style Selector="TextBlock#floatingWatermark:not(.notransitions)">
<Setter Property="Transitions">
<Transitions>
<ThicknessTransition Duration="0:0:0.25" Property="Margin" Easing="CubicEaseOut"/>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.25" Easing="CubicEaseOut"/>
</Transitions>
</Setter>
</Style>
</TextBlock.Styles>
</TextBlock>
<DataValidationErrors Name="DataValidation" >
<Grid ColumnDefinitions="Auto,*,Auto">
<ContentPresenter Grid.Column="0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Content="{TemplateBinding InnerLeftContent}" />
<ScrollViewer Grid.Column="1"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel Margin="1,27,12,8"
VerticalAlignment="Bottom">
<TextBlock Name="watermark"
Margin="0,5,0,0"
Classes="Subtitle1"
Opacity="0.5"
Text="{TemplateBinding Watermark}"
FontFamily="{TemplateBinding FontFamily}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}">
</TextBlock>
<TextPresenter Name="PART_TextPresenter"
Margin="0,5,0,0"
FontSize="16"
Text="{TemplateBinding Text, Mode=TwoWay}"
CaretIndex="{TemplateBinding CaretIndex}"
SelectionStart="{TemplateBinding SelectionStart}"
SelectionEnd="{TemplateBinding SelectionEnd}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
CaretBrush="{TemplateBinding CaretBrush}" />
</Panel>
</ScrollViewer>
<ContentPresenter Grid.Column="2"
MinHeight="32"
VerticalAlignment="Top"
Content="{TemplateBinding InnerRightContent}" />
</Grid>
</DataValidationErrors>
<styles:MaterialUnderline Classes="MirrorY"
VerticalAlignment="Bottom"
Name="Underline"/>
</Grid>
</Border>
<TextBlock Classes="Caption"
Margin="0,3,0,0"
Text="{Binding ElementName=DataValidation, Path=Errors}"
Foreground="#f44336"/>
</StackPanel>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="TextBox:focus:empty /template/ TextBlock#watermark,
TextBox:empty /template/ TextBlock#watermark">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="TextBox:focus:not(:empty) /template/ TextBlock#watermark,
TextBox:not(:empty) /template/ TextBlock#watermark">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="TextBox /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}" />
</Style>
<Style Selector="TextBox:focus /template/ styles|MaterialUnderline#Underline">
<Setter Property="IsExpanded" Value="True"></Setter>
</Style>
<Style Selector="TextBox:pointerover /template/ styles|MaterialUnderline#Underline">
<Setter Property="IsActive" Value="True"></Setter>
</Style>
<Style Selector="TextBox:disabled /template/ Border#border">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
<Style Selector="TextBox:not(.Outline):focus:not(:empty) /template/ TextBlock#floatingWatermark,
TextBox:not(.Outline):focus /template/ TextBlock#floatingWatermark,
TextBox:not(.Outline):not(:empty) /template/ TextBlock#floatingWatermark">
<Setter Property="Margin" Value="1,10,1,1"/>
<Setter Property="RenderTransform" Value="scale(0.75)"/>
</Style>
<Style Selector="TextBox:not(.Outline):empty:not(:focus) /template/ TextBlock#floatingWatermark">
<Setter Property="Margin" Value="1,32,1,1"/>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="1"/>
</Setter.Value>
</Setter>
</Style>
<!-- Standard TextBox variants (with clear button or with reveal password switch) -->
<Style Selector="TextBox.clearButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
<Setter Property="InnerRightContent">
<Template>
<Panel Height="56">
<Button Classes="Icon textBoxClearButton"
Command="{Binding $parent[TextBox].Clear}"
Cursor="Arrow" Width="28" Height="28"
Focusable="True"
VerticalAlignment="Bottom"
Padding="8" Margin="4, 4, 0, 4">
<Path x:Name="PART_GlyphElement"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{StaticResource TextBoxClearButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
</Panel>
</Template>
</Setter>
</Style>
<Style Selector="TextBox.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
<Setter Property="InnerRightContent">
<Template>
<Panel Height="56">
<Panel.Styles>
<Style Selector="ToggleButton[IsChecked=True]">
<Setter Property="(ToolTip.Tip)" Value="Hide Password" />
</Style>
<Style Selector="ToggleButton[IsChecked=False]">
<Setter Property="(ToolTip.Tip)" Value="Show Password" />
</Style>
</Panel.Styles>
<ToggleButton Classes="Icon passwordBoxRevealButton TransparentBack"
Cursor="Arrow" Width="28" Height="28"
Padding="4" Margin="4, 4, 0, 4"
Focusable="True"
VerticalAlignment="Bottom"
IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=OneWayToSource}" >
<ToggleButton.Styles>
<Style Selector="ToggleButton.passwordBoxRevealButton:checked Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:checked Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton">
<Setter Property="Focusable" Value="True" />
</Style>
</ToggleButton.Styles>
<Panel>
<Path x:Name="PART_GlyphElement_Reveal"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{DynamicResource PasswordBoxRevealButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="PART_GlyphElement_Hide"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{DynamicResource PasswordBoxHideButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</ToggleButton>
</Panel>
</Template>
</Setter>
</Style>
<!-- Filled textbox -->
<Style Selector="TextBox.Filled">
<Setter Property="Background" Value="{DynamicResource MaterialDesignTextFieldBoxBackground}" />
<Setter Property="SelectionBrush" Value="{DynamicResource MaterialDesignSelection}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource PrimaryHueMidForegroundBrush}" />
<Setter Property="Padding" Value="0,8" />
<Setter Property="ContextMenu" Value="{StaticResource DefaultTextBoxContextMenu}" />
<Setter Property="CaretBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}"></Setter>
<Setter Property="FontFamily" Value="avares://Material.Styles/Fonts/Roboto#Roboto"/>
<Setter Property="Template">
<ControlTemplate>
<StackPanel>
<Border Name="border"
Cursor="Ibeam"
MinHeight="48"
CornerRadius="8,8,0,0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border.Styles>
<Style Selector="Border:disabled, TextBlock:disabled">
<Setter Property="Opacity" Value="0.5" />
</Style>
</Border.Styles>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border Name="focusBorder"
CornerRadius="8,8,0,0"
Background="{TemplateBinding Background}" />
<TextBlock Name="floatingWatermark"
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
Classes="Subtitle1"
Foreground="{DynamicResource ThemeAccentBrush}"
FontSize="{DynamicResource FontSizeSmall}"
Text="{TemplateBinding Watermark}"
RenderTransformOrigin="0, 0"
IsVisible="{TemplateBinding UseFloatingWatermark}">
<TextBlock.Styles>
<Style Selector="TextBlock#floatingWatermark:not(.notransitions)">
<Setter Property="Transitions">
<Transitions>
<ThicknessTransition Duration="0:0:0.25" Property="Margin" Easing="CubicEaseOut"/>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.25" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
</TextBlock.Styles>
</TextBlock>
<DataValidationErrors Name="DataValidation" >
<Grid ColumnDefinitions="Auto,*,Auto">
<ContentPresenter Grid.Column="0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Content="{TemplateBinding InnerLeftContent}" />
<ScrollViewer Grid.Column="1"
Margin="10,27,10,10"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<TextPresenter Name="PART_TextPresenter"
FontSize="16"
FontWeight="Regular"
Text="{TemplateBinding Text, Mode=TwoWay}"
CaretIndex="{TemplateBinding CaretIndex}"
SelectionStart="{TemplateBinding SelectionStart}"
SelectionEnd="{TemplateBinding SelectionEnd}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
CaretBrush="{TemplateBinding CaretBrush}" />
</ScrollViewer>
<ContentPresenter Grid.Column="2"
MinHeight="32"
VerticalAlignment="Top"
Content="{TemplateBinding InnerRightContent}" />
</Grid>
</DataValidationErrors>
<styles:MaterialUnderline Classes="MirrorY"
VerticalAlignment="Bottom"
Name="Underline"/>
</Grid>
</Border>
<TextBlock Classes="Caption"
Margin="0,3,0,0"
Text="{Binding ElementName=DataValidation, Path=Errors}"
Foreground="#f44336"/>
</StackPanel>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="TextBox.Filled:focus:not(:empty) /template/ TextBlock#floatingWatermark,
TextBox.Filled:focus /template/ TextBlock#floatingWatermark,
TextBox.Filled:not(:empty) /template/ TextBlock#floatingWatermark">
<Setter Property="Margin" Value="10,10,1,1"/>
<Setter Property="RenderTransform" Value="scale(0.75)"/>
</Style>
<Style Selector="TextBox.Filled:focus /template/ Border#focusBorder">
<Setter Property="Opacity" Value="0.35"/>
</Style>
<Style Selector="TextBox.Filled:empty:not(:focus) /template/ TextBlock#floatingWatermark">
<Setter Property="Margin" Value="10,20,1,1"/>
</Style>
<!-- Filled TextBox variants (with clear button or with reveal password switch) -->
<Style Selector="TextBox.Filled.clearButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty),
TextBox.Outline.clearButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
<Setter Property="InnerRightContent">
<Template>
<Panel Height="56" Margin="0,0,8,0">
<Button Classes="Icon textBoxClearButton"
Command="{Binding $parent[TextBox].Clear}"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Cursor="Arrow" Width="36" Height="36"
Padding="12"
Focusable="True" Margin="0, 4">
<Path x:Name="PART_GlyphElement"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{StaticResource TextBoxClearButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
</Panel>
</Template>
</Setter>
</Style>
<Style Selector="TextBox.Filled.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False],
TextBox.Outline.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]">
<Setter Property="InnerRightContent">
<Template>
<Panel Height="56" Margin="0,0,8,0">
<Panel.Styles>
<Style Selector="ToggleButton[IsChecked=True]">
<Setter Property="(ToolTip.Tip)" Value="Hide Password" />
</Style>
<Style Selector="ToggleButton[IsChecked=False]">
<Setter Property="(ToolTip.Tip)" Value="Show Password" />
</Style>
</Panel.Styles>
<ToggleButton Classes="Icon passwordBoxRevealButton TransparentBack"
VerticalContentAlignment="Center"
Cursor="Arrow" Width="36" Height="36"
VerticalAlignment="Center"
Padding="8"
Margin="0, 4"
Focusable="True"
IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=OneWayToSource}" >
<ToggleButton.Styles>
<Style Selector="ToggleButton.passwordBoxRevealButton:checked Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:checked Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton">
<Setter Property="Focusable" Value="True" />
</Style>
</ToggleButton.Styles>
<Panel>
<Path x:Name="PART_GlyphElement_Reveal"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{DynamicResource PasswordBoxRevealButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="PART_GlyphElement_Hide"
Fill="{DynamicResource PrimaryHueMidBrush}"
Data="{DynamicResource PasswordBoxHideButtonData}"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</ToggleButton>
</Panel>
</Template>
</Setter>
</Style>
<!-- Outline textbox -->
<Style Selector="TextBox.Outline">
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}" />
<Setter Property="SelectionBrush" Value="{DynamicResource MaterialDesignSelection}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource PrimaryHueMidForegroundBrush}" />
<Setter Property="Padding" Value="0,8" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="ContextMenu" Value="{StaticResource DefaultTextBoxContextMenu}" />
<Setter Property="CaretBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}"></Setter>
<Setter Property="FontFamily" Value="avares://Material.Styles/Fonts/Roboto#Roboto"/>
<Setter Property="Template">
<ControlTemplate>
<StackPanel>
<Border Name="border"
Cursor="Ibeam"
CornerRadius="4"
Margin="0,8"
BorderThickness="1"
BorderBrush="{TemplateBinding BorderBrush}"
ClipToBounds="False">
<Border.Styles>
<Style Selector="Border:disabled, TextBlock:disabled">
<Setter Property="Opacity" Value="0.5" />
</Style>
</Border.Styles>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border Name="watermarkRoot"
x:Name="watermarkRoot"
Background="{DynamicResource MaterialDesignPaper }"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Opacity="1"
IsVisible="{TemplateBinding UseFloatingWatermark}">
<Border.Styles>
<Style Selector="Border#watermarkRoot:not(.notransitions)">
<Setter Property="Transitions">
<Transitions>
<ThicknessTransition Duration="0:0:0.25" Property="Margin" Easing="CubicEaseOut"/>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.25" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
</Border.Styles>
<TextBlock Name="floatingWatermark"
Classes="Subtitle1"
Margin="4,2"
Foreground="{DynamicResource ThemeAccentBrush}"
Text="{TemplateBinding Watermark}" />
</Border>
<DataValidationErrors Name="DataValidation" >
<Grid ColumnDefinitions="Auto,*,Auto">
<ContentPresenter Grid.Column="0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Content="{TemplateBinding InnerLeftContent}" />
<ScrollViewer Grid.Column="1"
Margin="14,18.5"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<TextPresenter Name="PART_TextPresenter"
FontSize="16"
FontWeight="Regular"
ClipToBounds="True"
Text="{TemplateBinding Text, Mode=TwoWay}"
CaretIndex="{TemplateBinding CaretIndex}"
SelectionStart="{TemplateBinding SelectionStart}"
SelectionEnd="{TemplateBinding SelectionEnd}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
CaretBrush="{TemplateBinding CaretBrush}" />
</ScrollViewer>
<ContentPresenter Grid.Column="2"
MinHeight="32"
VerticalAlignment="Top"
Content="{TemplateBinding InnerRightContent}" />
</Grid>
</DataValidationErrors>
</Grid>
</Border>
</StackPanel>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="TextBox.Outline:focus:not(:empty) /template/ Border#watermarkRoot,
TextBox.Outline:focus /template/ Border#watermarkRoot,
TextBox.Outline:not(:empty) /template/ Border#watermarkRoot">
<Setter Property="Margin" Value="6,-12,1,1"/>
<Setter Property="RenderTransform" Value="scale(0.75)"/>
</Style>
<Style Selector="TextBox.Outline:focus /template/ Border#focusBorder">
<Setter Property="Opacity" Value="0.35"/>
</Style>
<Style Selector="TextBox.Outline:empty:not(:focus) /template/ Border#watermarkRoot">
<Setter Property="Margin" Value="10,18,1,1"/>
</Style>
<Design.PreviewWith>
<Border Padding="20">
<StackPanel>
<TextBox Classes="" Margin="8" Width="200" UseFloatingWatermark="True" Watermark="TextBox"/>
<TextBox Classes="Filled" Width="200" UseFloatingWatermark="True" Watermark="TextBox"/>
<TextBox Classes="Filled" IsEnabled="False" Width="200" UseFloatingWatermark="True" Watermark="TextBox"/>
<TextBox Classes="Outline" IsEnabled="True" Width="200" UseFloatingWatermark="True" Watermark="TextBox"/>
</StackPanel>
</Border>
</Design.PreviewWith>
</Styles>