csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
4.2 KiB
83 lines
4.2 KiB
<Styles xmlns="https://github.com/avaloniaui">
|
|
<Style Selector="TextBox">
|
|
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
|
|
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
|
|
<Setter Property="Padding" Value="4"/>
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Name="border"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|
<DockPanel Margin="{TemplateBinding Padding}">
|
|
|
|
<TextBlock Name="floatingWatermark"
|
|
Foreground="{DynamicResource ThemeAccentBrush}"
|
|
FontSize="{DynamicResource FontSizeSmall}"
|
|
Text="{TemplateBinding Watermark}"
|
|
DockPanel.Dock="Top">
|
|
<TextBlock.IsVisible>
|
|
<MultiBinding Converter="{Static BoolConverters.And}">
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
|
Path="UseFloatingWatermark"/>
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
|
Path="Text"
|
|
Converter="{Static StringConverters.NotNullOrEmpty}"/>
|
|
</MultiBinding>
|
|
</TextBlock.IsVisible>
|
|
</TextBlock>
|
|
|
|
<DockPanel LastChildFill="True">
|
|
<Canvas Name="error" DockPanel.Dock="Right" Width="14" Height="14" Margin="4 0 1 0">
|
|
<ToolTip.Tip>
|
|
<ItemsControl Items="{TemplateBinding DataValidationErrors}" MemberSelector="Message"/>
|
|
</ToolTip.Tip>
|
|
<Path Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2" Stroke="{DynamicResource ErrorBrush}" StrokeThickness="2"/>
|
|
</Canvas>
|
|
|
|
<ScrollViewer CanScrollHorizontally="{TemplateBinding CanScrollHorizontally}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
|
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
|
|
|
<Panel>
|
|
<TextBlock Name="watermark"
|
|
Opacity="0.5"
|
|
Text="{TemplateBinding Watermark}"
|
|
IsVisible="{TemplateBinding Path=Text, Converter={Static StringConverters.NullOrEmpty}}"/>
|
|
<TextPresenter Name="PART_TextPresenter"
|
|
Text="{TemplateBinding Text, Mode=TwoWay}"
|
|
CaretIndex="{TemplateBinding CaretIndex}"
|
|
SelectionStart="{TemplateBinding SelectionStart}"
|
|
SelectionEnd="{TemplateBinding SelectionEnd}"
|
|
TextAlignment="{TemplateBinding TextAlignment}"
|
|
TextWrapping="{TemplateBinding TextWrapping}"/>
|
|
</Panel>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
|
|
</DockPanel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
<Style Selector="TextBox:pointerover /template/ Border#border">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
|
|
</Style>
|
|
<Style Selector="TextBox:focus /template/ Border#border">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
|
|
</Style>
|
|
<Style Selector="TextBox:error /template/ Border#border">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/>
|
|
</Style>
|
|
<Style Selector="TextBox /template/ Canvas#error">
|
|
<Setter Property="IsVisible" Value="False"/>
|
|
</Style>
|
|
<Style Selector="TextBox:error /template/ Canvas#error">
|
|
<Setter Property="IsVisible" Value="True"/>
|
|
</Style>
|
|
<Style Selector="TextBox /template/ ToolTip">
|
|
<Setter Property="Background" Value="{DynamicResource ErrorBrushLight}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/>
|
|
</Style>
|
|
</Styles>
|