Files
Shrlalgo.RvKits/NeuWPF/NeoUI/Controls/ChooseBox.xaml

182 lines
12 KiB
Plaintext
Raw Normal View History

2025-08-12 23:08:54 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2025-08-20 12:10:35 +08:00
xmlns:assists="clr-namespace:NeoUI.Assists"
xmlns:controls="clr-namespace:NeoUI.Controls"
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
2025-08-12 23:08:54 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--<ResourceDictionary.MergedDictionaries>
-->
<!--<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Resources/DesignTime.xaml" />-->
<!--
<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Resources/Variables.xaml" />
<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Controls/TextBox/TextBox.xaml" />
</ResourceDictionary.MergedDictionaries>-->
<PathGeometry Figures="M147.01175 430.890704c-44.791136 0-81.108273 36.303834-81.108273 81.109296 0 44.778856 36.316114 81.108273 81.108273 81.108273 44.792159 0 81.109296-36.329417 81.109296-81.108273C228.121046 467.194538 191.804932 430.890704 147.01175 430.890704zM511.999488 430.890704c-44.791136 0-81.108273 36.303834-81.108273 81.109296 0 44.778856 36.316114 81.108273 81.108273 81.108273 44.792159 0 81.109296-36.329417 81.109296-81.108273C593.108784 467.194538 556.791647 430.890704 511.999488 430.890704zM876.987227 430.890704c-44.791136 0-81.108273 36.303834-81.108273 81.109296 0 44.778856 36.316114 81.108273 81.108273 81.108273s81.108273-36.329417 81.108273-81.108273C958.094476 467.194538 921.778362 430.890704 876.987227 430.890704z" x:Key="Icon" />
2025-08-20 12:10:13 +08:00
<!--<Style x:Key="ChooseButtonStyle" TargetType="Button">
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Path
2025-08-20 12:10:13 +08:00
x:Name="icon"
Width="12"
2025-08-12 23:08:54 +08:00
HorizontalAlignment="Left"
VerticalAlignment="Center"
2025-08-20 12:10:13 +08:00
Data="{StaticResource Icon}"
Fill="{DynamicResource TextPrimaryBrush}"
Stretch="Uniform" />
2025-08-12 23:08:54 +08:00
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
2025-08-20 12:10:13 +08:00
<Setter TargetName="icon" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
2025-08-12 23:08:54 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
2025-08-20 12:10:13 +08:00
</Style>-->
2025-08-12 23:08:54 +08:00
<Style TargetType="{x:Type controls:ChooseBox}">
2025-08-20 12:10:13 +08:00
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
2025-08-12 23:08:54 +08:00
<Setter Property="Border.CornerRadius" Value="4" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="ChooseButtonWidth" Value="20" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="200" />
2025-08-20 12:10:13 +08:00
<Setter Property="Padding" Value="3" />
2025-08-12 23:08:54 +08:00
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:ChooseBox}">
<Grid>
2025-08-20 12:10:13 +08:00
<svd:SlotBorder
2025-08-12 23:08:54 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding Border.CornerRadius}"
HorizontalAlignment="Stretch"
2025-08-20 12:10:13 +08:00
Intensity="0.2"
2025-08-12 23:08:54 +08:00
MinHeight="{TemplateBinding MinHeight}"
MinWidth="{TemplateBinding MinWidth}"
Padding="0"
2025-08-20 12:10:13 +08:00
VerticalAlignment="Stretch"
x:Name="ContentBorder">
2025-08-12 23:08:54 +08:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
2025-08-20 12:10:13 +08:00
Margin="5,0,0,0"
2025-08-12 23:08:54 +08:00
Name="PlaceholderTextBlock"
2025-08-20 12:10:35 +08:00
Text="{TemplateBinding Placeholder}"
2025-08-12 23:08:54 +08:00
VerticalAlignment="Center"
Visibility="Collapsed" />
<ScrollViewer
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
Foreground="{TemplateBinding Foreground}"
Grid.Column="0"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
Margin="{TemplateBinding Padding}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
x:Name="PART_ContentHost" />
<Button
2025-08-20 12:10:13 +08:00
Background="Transparent"
Foreground="{DynamicResource TextSecondaryBrush}"
2025-08-12 23:08:54 +08:00
Grid.Column="1"
2025-08-20 12:10:13 +08:00
Padding="0"
Style="{DynamicResource FlattenButton}"
2025-08-12 23:08:54 +08:00
Width="{TemplateBinding ChooseButtonWidth}"
2025-08-20 12:10:13 +08:00
x:Name="PART_ChooseButton">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Path
Data="{StaticResource Icon}"
Fill="{DynamicResource TextPrimaryBrush}"
HorizontalAlignment="Left"
Stretch="Uniform"
VerticalAlignment="Center"
Width="12"
x:Name="icon" />
</Border>
</Button>
2025-08-12 23:08:54 +08:00
</Grid>
2025-08-20 12:10:13 +08:00
</svd:SlotBorder>
2025-08-12 23:08:54 +08:00
<!--<Border
BorderBrush="Transparent"
BorderThickness="1"
CornerRadius="{TemplateBinding Border.CornerRadius}"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
Name="AccentBorder"
VerticalAlignment="Stretch" />-->
</Grid>
<ControlTemplate.Triggers>
<!--<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="bordermove" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="bordermove" Property="Opacity" Value="1" />
</Trigger>-->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsEnabled" Value="True" />
<Condition Property="UIElement.IsMouseOver" Value="True" />
2025-08-20 12:10:13 +08:00
<!--<Condition Property="UIElement.IsFocused" Value="False" />-->
2025-08-12 23:08:54 +08:00
</MultiTrigger.Conditions>
2025-08-20 12:10:13 +08:00
<Setter Property="Intensity" TargetName="ContentBorder" Value="0.5" />
2025-08-12 23:08:54 +08:00
</MultiTrigger>
<Trigger Property="Text" Value="">
<Setter Property="Visibility" TargetName="PlaceholderTextBlock" Value="Visible" />
</Trigger>
2025-08-20 12:10:13 +08:00
2025-08-12 23:08:54 +08:00
<Trigger Property="IsEnabled" Value="False">
2025-08-20 12:10:13 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="ShaderEnabled" TargetName="ContentBorder" Value="False" />
<!--<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />-->
2025-08-12 23:08:54 +08:00
<!--<Setter Property="BorderBrush" TargetName="AccentBorder" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />-->
<!-- <Setter Property="controls:TextBoxEx.ClearButtonEnabled" Value="False" /> -->
2025-08-20 12:10:13 +08:00
<!--<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />-->
2025-08-12 23:08:54 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
<!--<Trigger Property="UIElement.IsFocused" Value="True">
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlStrongBackgroundFocusedBrush}" />
-->
<!--<Setter Property="BorderBrush" TargetName="AccentBorder" Value="{DynamicResource SystemFillColorAttentionBrush}" />-->
<!--<Setter Property="BorderThickness" TargetName="AccentBorder" Value="0,0,0,2" />-->
<!--
</Trigger>-->
2025-08-12 23:08:54 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>