refactor: extended templates for ComboBox, NumericUpDown, and TextBox
This commit is contained in:
1 parent
97110e9dc9
commit
48908ade16
3 files changed
+260
-656
No files matched your search
@@ -190,257 +190,6 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxExtendTopTemplate"
|
||||
TargetType="ComboBox">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheTop), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Row="1">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="3"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding PlaceholderText}" />
|
||||
<ContentControl x:Name="ContentPresenter"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
<Button Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[ComboBox].Clear}"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0,0,3,0"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush, ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<Panel Grid.Column="2"
|
||||
Margin="{TemplateBinding BorderThickness, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}">
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen, Converter={x:Static BoolConverters.Not}}"
|
||||
Data="{StaticResource DownGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen}"
|
||||
Data="{StaticResource UpGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
</Panel>
|
||||
<Popup Grid.Column="0"
|
||||
Name="PART_Popup"
|
||||
WindowManagerAddShadowHint="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
|
||||
PlacementTarget="border"
|
||||
IsLightDismissEnabled="True"
|
||||
InheritsTransform="True">
|
||||
<Border x:Name="PopupBorder"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8,0,8,8"
|
||||
Effect="{StaticResource EffectShadow2}"
|
||||
HorizontalAlignment="Stretch"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
Margin="2">
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxExtendLeftTemplate"
|
||||
TargetType="ComboBox">
|
||||
<Grid MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=(hc:TitleElement.TitleWidth), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
VerticalAlignment="{Binding Path=(hc:TitleElement.VerticalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheLeft), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Column="1">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="3"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding PlaceholderText}" />
|
||||
<ContentControl x:Name="ContentPresenter"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
<Button Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[ComboBox].Clear}"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0,0,4,0"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush, ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<Panel Grid.Column="2"
|
||||
Margin="{TemplateBinding BorderThickness, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}">
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen, Converter={x:Static BoolConverters.Not}}"
|
||||
Data="{StaticResource DownGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen}"
|
||||
Data="{StaticResource UpGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
</Panel>
|
||||
<Popup Grid.Column="0"
|
||||
Name="PART_Popup"
|
||||
WindowManagerAddShadowHint="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
|
||||
PlacementTarget="border"
|
||||
IsLightDismissEnabled="True"
|
||||
InheritsTransform="True">
|
||||
<Border x:Name="PopupBorder"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8,0,8,8"
|
||||
Effect="{StaticResource EffectShadow2}"
|
||||
HorizontalAlignment="Stretch"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
Margin="2">
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTheme x:Key="ComboBoxExtendBaseStyle"
|
||||
BasedOn="{StaticResource ComboBoxBaseStyle}"
|
||||
TargetType="ComboBox">
|
||||
<Setter Property="hc:InfoElement.Symbol"
|
||||
Value="●" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource ComboBoxExtendTopTemplate}" />
|
||||
|
||||
<Style Selector="^[(hc|TitleElement.TitlePlacement)=Left]">
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource ComboBoxExtendLeftTemplate}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type ComboBox}"
|
||||
BasedOn="{StaticResource ComboBoxBaseStyle}"
|
||||
TargetType="ComboBox" />
|
||||
@@ -466,8 +215,110 @@
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ComboBoxExtend"
|
||||
BasedOn="{StaticResource ComboBoxExtendBaseStyle}"
|
||||
TargetType="ComboBox" />
|
||||
BasedOn="{StaticResource ComboBoxBaseStyle}"
|
||||
TargetType="ComboBox">
|
||||
<Setter Property="hc:InfoElement.Symbol"
|
||||
Value="●" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<HeaderedContentControl Header="{Binding $parent.(hc:TitleElement.Title)}">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="3"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding PlaceholderText}" />
|
||||
<ContentControl x:Name="ContentPresenter"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
<Button Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[ComboBox].Clear}"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0,0,3,0"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush, ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<Panel Grid.Column="2"
|
||||
Margin="{TemplateBinding BorderThickness, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}">
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen, Converter={x:Static BoolConverters.Not}}"
|
||||
Data="{StaticResource DownGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
<Path IsVisible="{TemplateBinding IsDropDownOpen}"
|
||||
Data="{StaticResource UpGeometry}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="14"
|
||||
Stretch="Uniform"
|
||||
Fill="{Binding BorderBrush, ElementName=border}"
|
||||
Margin="{TemplateBinding Padding, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" />
|
||||
</Panel>
|
||||
<Popup Grid.Column="0"
|
||||
Name="PART_Popup"
|
||||
WindowManagerAddShadowHint="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
|
||||
PlacementTarget="border"
|
||||
IsLightDismissEnabled="True"
|
||||
InheritsTransform="True">
|
||||
<Border x:Name="PopupBorder"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8,0,8,8"
|
||||
Effect="{StaticResource EffectShadow2}"
|
||||
HorizontalAlignment="Stretch"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
Margin="2">
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ComboBoxExtend.Small"
|
||||
BasedOn="{StaticResource ComboBoxExtend}"
|
||||
|
||||
@@ -95,192 +95,6 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTemplate x:Key="NumericUpDownExtendTopTemplate"
|
||||
TargetType="NumericUpDown">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheTop), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Row="1">
|
||||
<ButtonSpinner Name="PART_Spinner"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
IsTabStop="False"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
MinWidth="0"
|
||||
AllowSpin="{TemplateBinding AllowSpin}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||
<DockPanel>
|
||||
<Button HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Command="{Binding Clear, ElementName=PART_TextBox}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0,0,4,0"
|
||||
Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,-1,0'}"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=PART_Spinner}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<TextBox Name="PART_TextBox"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Padding="0"
|
||||
MinWidth="0"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Watermark="{TemplateBinding Watermark}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Text="{TemplateBinding Text}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="NoWrap" />
|
||||
</DockPanel>
|
||||
</ButtonSpinner>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="NumericUpDownExtendLeftTemplate"
|
||||
TargetType="NumericUpDown">
|
||||
<Grid MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=(hc:TitleElement.TitleWidth), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
VerticalAlignment="{Binding Path=(hc:TitleElement.VerticalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheLeft), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Column="1">
|
||||
<ButtonSpinner Name="PART_Spinner"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
IsTabStop="False"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
MinWidth="0"
|
||||
AllowSpin="{TemplateBinding AllowSpin}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||
<DockPanel>
|
||||
<Button HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Command="{Binding Clear, ElementName=PART_TextBox}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=PART_Spinner}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<TextBox Name="PART_TextBox"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Padding="0"
|
||||
MinWidth="0"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Watermark="{TemplateBinding Watermark}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Text="{TemplateBinding Text}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="NoWrap" />
|
||||
</DockPanel>
|
||||
</ButtonSpinner>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTheme x:Key="NumericUpDownExtendBaseStyle"
|
||||
BasedOn="{StaticResource NumericUpDownBaseStyle}"
|
||||
TargetType="NumericUpDown">
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource NumericUpDownExtendTopTemplate}" />
|
||||
|
||||
<Style Selector="^[(hc|TitleElement.TitlePlacement)=Left]">
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource NumericUpDownExtendLeftTemplate}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type NumericUpDown}"
|
||||
BasedOn="{StaticResource NumericUpDownBaseStyle}"
|
||||
TargetType="NumericUpDown" />
|
||||
@@ -295,8 +109,77 @@
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="NumericUpDownExtend"
|
||||
BasedOn="{StaticResource NumericUpDownExtendBaseStyle}"
|
||||
TargetType="NumericUpDown" />
|
||||
BasedOn="{StaticResource NumericUpDownBaseStyle}"
|
||||
TargetType="NumericUpDown">
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<HeaderedContentControl Header="{Binding $parent.(hc:TitleElement.Title)}">
|
||||
<ButtonSpinner Name="PART_Spinner"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
IsTabStop="False"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
MinWidth="0"
|
||||
AllowSpin="{TemplateBinding AllowSpin}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||
<DockPanel>
|
||||
<Button HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Width="{x:Static system:Double.NaN}"
|
||||
Command="{Binding Clear, ElementName=PART_TextBox}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="0,0,4,0"
|
||||
Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,-1,0'}"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=PART_Spinner}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
<TextBox Name="PART_TextBox"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Padding="0"
|
||||
MinWidth="0"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Watermark="{TemplateBinding Watermark}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Text="{TemplateBinding Text}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="NoWrap" />
|
||||
</DockPanel>
|
||||
</ButtonSpinner>
|
||||
</HeaderedContentControl>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="NumericUpDownExtend.Small"
|
||||
BasedOn="{StaticResource NumericUpDownExtend}"
|
||||
|
||||
@@ -115,219 +115,6 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTemplate x:Key="TextBoxExtendTopTemplate"
|
||||
TargetType="TextBox">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheTop), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Row="1">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="2"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding Watermark}" />
|
||||
<ScrollViewer Grid.Column="0"
|
||||
Name="PART_ScrollViewer"
|
||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||
<TextPresenter Name="PART_TextPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
CaretIndex="{TemplateBinding CaretIndex}"
|
||||
LineHeight="{TemplateBinding LineHeight}"
|
||||
LetterSpacing="{TemplateBinding LetterSpacing}"
|
||||
PasswordChar="{TemplateBinding PasswordChar}"
|
||||
RevealPassword="{TemplateBinding RevealPassword}"
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
SelectionStart="{TemplateBinding SelectionStart}"
|
||||
Text="{TemplateBinding Text,Mode=TwoWay}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||
<ScrollViewer.Styles>
|
||||
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Cursor"
|
||||
Value="IBeam" />
|
||||
</Style>
|
||||
</ScrollViewer.Styles>
|
||||
</ScrollViewer>
|
||||
<Button HorizontalContentAlignment="Left"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[TextBox].Clear}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
Grid.Column="1"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="TextBoxExtendLeftTemplate"
|
||||
TargetType="TextBox">
|
||||
<Grid MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Height="{Binding Path=(hc:InfoElement.ContentHeight), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=(hc:TitleElement.TitleWidth), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel LastChildFill="True"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent},Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
VerticalAlignment="{Binding Path=(hc:TitleElement.VerticalAlignment), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{Binding Path=(hc:TitleElement.MarginOnTheLeft), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter DockPanel.Dock="Right"
|
||||
TextElement.Foreground="{DynamicResource DangerBrush}"
|
||||
Margin="4,0,0,0"
|
||||
Content="{Binding Path=(hc:InfoElement.Symbol), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsVisible="{Binding Path=(hc:InfoElement.Necessary), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<TextBlock TextWrapping="NoWrap"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</DockPanel>
|
||||
<DataValidationErrors Grid.Column="1">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="2"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding Watermark}" />
|
||||
<ScrollViewer Grid.Column="0"
|
||||
Name="PART_ScrollViewer"
|
||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||
<TextPresenter Name="PART_TextPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
CaretIndex="{TemplateBinding CaretIndex}"
|
||||
LineHeight="{TemplateBinding LineHeight}"
|
||||
LetterSpacing="{TemplateBinding LetterSpacing}"
|
||||
PasswordChar="{TemplateBinding PasswordChar}"
|
||||
RevealPassword="{TemplateBinding RevealPassword}"
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
SelectionStart="{TemplateBinding SelectionStart}"
|
||||
Text="{TemplateBinding Text,Mode=TwoWay}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||
<ScrollViewer.Styles>
|
||||
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Cursor"
|
||||
Value="IBeam" />
|
||||
</Style>
|
||||
</ScrollViewer.Styles>
|
||||
</ScrollViewer>
|
||||
<Button HorizontalContentAlignment="Left"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[TextBox].Clear}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
Grid.Column="1"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataValidationErrors>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTheme x:Key="TextBoxExtendBaseStyle"
|
||||
BasedOn="{StaticResource TextBoxBaseStyle}"
|
||||
TargetType="TextBox">
|
||||
<Setter Property="hc:InfoElement.Symbol"
|
||||
Value="●" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource TextBoxExtendTopTemplate}" />
|
||||
|
||||
<Style Selector="^[(hc|TitleElement.TitlePlacement)=Left]">
|
||||
<Setter Property="Template"
|
||||
Value="{StaticResource TextBoxExtendLeftTemplate}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type TextBox}"
|
||||
BasedOn="{StaticResource TextBoxBaseStyle}"
|
||||
TargetType="TextBox" />
|
||||
@@ -342,8 +129,91 @@
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBoxExtend"
|
||||
BasedOn="{StaticResource TextBoxExtendBaseStyle}"
|
||||
TargetType="TextBox" />
|
||||
BasedOn="{StaticResource TextBoxBaseStyle}"
|
||||
TargetType="TextBox">
|
||||
<Setter Property="hc:InfoElement.Symbol"
|
||||
Value="●" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight"
|
||||
Value="{x:Static system:Double.NaN}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight"
|
||||
Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<HeaderedContentControl Header="{Binding $parent.(hc:TitleElement.Title)}">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Border x:Name="border"
|
||||
Grid.ColumnSpan="2"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||
Text="{TemplateBinding Watermark}" />
|
||||
<ScrollViewer Grid.Column="0"
|
||||
Name="PART_ScrollViewer"
|
||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||
<TextPresenter Name="PART_TextPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
CaretIndex="{TemplateBinding CaretIndex}"
|
||||
LineHeight="{TemplateBinding LineHeight}"
|
||||
LetterSpacing="{TemplateBinding LetterSpacing}"
|
||||
PasswordChar="{TemplateBinding PasswordChar}"
|
||||
RevealPassword="{TemplateBinding RevealPassword}"
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
SelectionStart="{TemplateBinding SelectionStart}"
|
||||
Text="{TemplateBinding Text,Mode=TwoWay}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||
<ScrollViewer.Styles>
|
||||
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Cursor"
|
||||
Value="IBeam" />
|
||||
</Style>
|
||||
</ScrollViewer.Styles>
|
||||
</ScrollViewer>
|
||||
<Button HorizontalContentAlignment="Left"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
hc:IconElement.Width="14"
|
||||
Command="{Binding $parent[TextBox].Clear}"
|
||||
Name="ButtonClear"
|
||||
Focusable="False"
|
||||
Grid.Column="1"
|
||||
Theme="{StaticResource ButtonIcon}"
|
||||
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||
Foreground="{Binding BorderBrush,ElementName=border}">
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsPointerOver" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="(hc:InfoElement.ShowClearButton)" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Path="IsReadOnly"
|
||||
Converter="{x:Static BoolConverters.Not}" />
|
||||
</MultiBinding>
|
||||
</Button.IsVisible>
|
||||
</Button>
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBoxExtend.Small"
|
||||
BasedOn="{StaticResource TextBoxExtend}"
|
||||
|
||||
Reference in new issue
Block a user