451 lines
29 KiB
XML
451 lines
29 KiB
XML
<!--
|
|
This Source Code Form is subject to the terms of the MIT License.
|
|
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
|
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
|
All Rights Reserved.
|
|
|
|
Based on Microsoft XAML for Win UI
|
|
Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
-->
|
|
|
|
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:WPFluent.Controls"
|
|
xmlns:system="clr-namespace:System;assembly=System.Runtime">
|
|
|
|
<Thickness x:Key="TextBoxBorderThemeThickness">1,1,1,1</Thickness>
|
|
<Thickness x:Key="TextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
|
|
<Thickness x:Key="TextBoxLeftIconMargin">10,0,0,0</Thickness>
|
|
<Thickness x:Key="TextBoxRightIconMargin">0,0,10,0</Thickness>
|
|
<Thickness x:Key="TextBoxClearButtonMargin">0,0,4,0</Thickness>
|
|
<Thickness x:Key="TextBoxClearButtonPadding">0,0,0,0</Thickness>
|
|
<system:Double x:Key="TextBoxClearButtonHeight">24</system:Double>
|
|
|
|
<Style x:Key="DefaultTextBoxStyle" TargetType="{x:Type TextBox}">
|
|
<!-- Universal WPF UI focus -->
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<!-- Universal WPF UI focus -->
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
|
<Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
|
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{StaticResource TextBoxBorderThemeThickness}" />
|
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
|
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
|
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
|
|
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
|
|
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
|
|
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<Grid>
|
|
<Border
|
|
x:Name="ContentBorder"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
|
<Grid
|
|
Margin="{TemplateBinding Padding}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<controls:PassiveScrollViewer
|
|
x:Name="PART_ContentHost"
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
|
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
|
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
|
</Grid>
|
|
</Border>
|
|
<!-- The Accent Border is a separate element so that changes to the border thickness do not affect the position of the element -->
|
|
<Border
|
|
x:Name="AccentBorder"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
|
BorderThickness="{StaticResource TextBoxAccentBorderThemeThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}" />
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" />
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsEnabled" Value="True" />
|
|
<Condition Property="IsMouseOver" Value="True" />
|
|
<Condition Property="IsFocused" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="True">
|
|
<Setter Property="Cursor" Value="IBeam" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" />
|
|
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="Validation.HasError" Value="True">
|
|
<Setter Property="BorderBrush"
|
|
Value="{DynamicResource PaletteRedBrush}" />
|
|
<Setter Property="BorderThickness"
|
|
Value="1" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
|
|
<ControlTemplate x:Key="DefaultUiTextBoxControlTemplate" TargetType="{x:Type controls:TextBox}">
|
|
<Grid>
|
|
<Border
|
|
x:Name="ContentBorder"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ContentPresenter
|
|
x:Name="ControlIconLeft"
|
|
Grid.Column="0"
|
|
Margin="{StaticResource TextBoxLeftIconMargin}"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Icon}"
|
|
Focusable="False"
|
|
TextElement.FontSize="{TemplateBinding FontSize}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
Visibility="Visible" />
|
|
|
|
<Grid Grid.Column="1" Margin="{TemplateBinding Padding}">
|
|
<controls:PassiveScrollViewer
|
|
x:Name="PART_ContentHost"
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
|
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
|
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
|
<TextBlock
|
|
x:Name="PlaceholderTextBox"
|
|
Margin="0"
|
|
Padding="1,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
|
Text="{TemplateBinding PlaceholderText}" />
|
|
</Grid>
|
|
|
|
<!-- Buttons and Icons have no padding from the main element to allow absolute positions if height is larger than the text entry zone -->
|
|
<controls:Button
|
|
x:Name="ClearButton"
|
|
Grid.Column="2"
|
|
MinWidth="{StaticResource TextBoxClearButtonHeight}"
|
|
MinHeight="{StaticResource TextBoxClearButtonHeight}"
|
|
Margin="{StaticResource TextBoxClearButtonMargin}"
|
|
Padding="{StaticResource TextBoxClearButtonPadding}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Appearance="Secondary"
|
|
Background="Transparent"
|
|
BorderBrush="Transparent"
|
|
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
|
|
Cursor="Arrow"
|
|
Foreground="{DynamicResource TextControlButtonForeground}"
|
|
IsTabStop="False">
|
|
<controls:Button.Icon>
|
|
<controls:SymbolIcon FontSize="{TemplateBinding FontSize}" Symbol="Dismiss24" />
|
|
</controls:Button.Icon>
|
|
</controls:Button>
|
|
|
|
<ContentPresenter
|
|
x:Name="ControlIconRight"
|
|
Grid.Column="3"
|
|
Margin="{StaticResource TextBoxRightIconMargin}"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Icon}"
|
|
TextElement.FontSize="{TemplateBinding FontSize}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
|
</Grid>
|
|
</Border>
|
|
<!-- The Accent Border is a separate element so that changes to the border thickness do not affect the position of the element -->
|
|
<Border
|
|
x:Name="AccentBorder"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
|
BorderThickness="{StaticResource TextBoxAccentBorderThemeThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}" />
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="CurrentPlaceholderEnabled" Value="False">
|
|
<Setter TargetName="PlaceholderTextBox" Property="Visibility" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="ShowClearButton" Value="False">
|
|
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="ClearButtonEnabled" Value="False">
|
|
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="IconPlacement" Value="Left">
|
|
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="IconPlacement" Value="Right">
|
|
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
|
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
|
|
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" />
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsEnabled" Value="True" />
|
|
<Condition Property="IsMouseOver" Value="True" />
|
|
<Condition Property="IsFocused" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="True">
|
|
<Setter Property="Cursor" Value="IBeam" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" />
|
|
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
|
<Setter TargetName="ControlIconLeft" Property="TextElement.Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
|
<Setter TargetName="ControlIconRight" Property="TextElement.Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
|
<Setter TargetName="PlaceholderTextBox" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
|
<Setter Property="ClearButtonEnabled" Value="False" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="DefaultUiTextBoxTextSelectionEnabledControlTemplate" TargetType="{x:Type controls:TextBox}">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
|
<Border
|
|
x:Name="ContentBorder"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
|
Focusable="False">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<Grid Margin="{TemplateBinding Padding}">
|
|
<controls:PassiveScrollViewer
|
|
x:Name="PART_ContentHost"
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
|
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
|
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="DefaultUiTextBoxStyle" TargetType="{x:Type controls:TextBox}">
|
|
<!-- Universal WPF UI focus -->
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<!-- Universal WPF UI focus -->
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
|
<Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
|
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{StaticResource TextBoxBorderThemeThickness}" />
|
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
|
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
|
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
|
|
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
|
|
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
|
|
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
<Setter Property="ClearButtonEnabled" Value="True" />
|
|
<Setter Property="IconPlacement" Value="Left" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
|
<Style.Triggers>
|
|
<Trigger Property="IsTextSelectionEnabled" Value="False">
|
|
<Setter Property="Template" Value="{StaticResource DefaultUiTextBoxControlTemplate}" />
|
|
</Trigger>
|
|
<Trigger Property="IsTextSelectionEnabled" Value="True">
|
|
<Setter Property="IsReadOnly" Value="True" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Template" Value="{StaticResource DefaultUiTextBoxTextSelectionEnabledControlTemplate}" />
|
|
</Trigger>
|
|
<Trigger Property="Validation.HasError" Value="True">
|
|
<Setter Property="BorderBrush"
|
|
Value="{DynamicResource PaletteRedBrush}" />
|
|
<Setter Property="BorderThickness"
|
|
Value="1" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="TransparentTextBoxStyle" TargetType="{x:Type TextBox}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
</Style>
|
|
|
|
<Style x:Key="TransparentUiTextBoxStyle" TargetType="{x:Type controls:TextBox}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:TextBox}">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
|
<Border
|
|
x:Name="ContentBorder"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid Grid.Column="0" Margin="{TemplateBinding Padding}">
|
|
<ScrollViewer
|
|
x:Name="PART_ContentHost"
|
|
VerticalAlignment="Center"
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
|
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
|
Style="{StaticResource DefaultTextBoxScrollViewerStyle}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
|
<TextBlock
|
|
x:Name="PlaceholderTextBox"
|
|
Margin="0"
|
|
Padding="1,0"
|
|
VerticalAlignment="Center"
|
|
Text="{TemplateBinding PlaceholderText}"
|
|
Visibility="Collapsed">
|
|
<TextBlock.Foreground>
|
|
<SolidColorBrush Color="{DynamicResource TextPlaceholderColor}" />
|
|
</TextBlock.Foreground>
|
|
</TextBlock>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Text" Value="{x:Null}">
|
|
<Setter TargetName="PlaceholderTextBox" Property="Visibility" Value="Visible" />
|
|
</Trigger>
|
|
<Trigger Property="Text" Value="">
|
|
<Setter TargetName="PlaceholderTextBox" Property="Visibility" Value="Visible" />
|
|
</Trigger>
|
|
<Trigger Property="PlaceholderEnabled" Value="False">
|
|
<Setter TargetName="PlaceholderTextBox" Property="Visibility" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="True">
|
|
<Setter Property="Cursor" Value="IBeam" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="PlaceholderTextBox" Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
|
<Setter Property="ClearButtonEnabled" Value="False" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="{x:Type TextBox}" />
|
|
<Style BasedOn="{StaticResource DefaultUiTextBoxStyle}" TargetType="{x:Type controls:TextBox}" />
|
|
|
|
</ResourceDictionary>
|