Files
HandyControl/src/Shared/HandyControl_Shared/Themes/Styles/Base/TransferBaseStyle.xaml
T
2023-09-24 23:01:34 +08:00

82 lines
6.1 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
<Style x:Key="TransferItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:TransferItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualMargin0}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:TransferItem">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{Binding Padding,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='1,0,1,0'}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}" />
</Trigger>
<Trigger Property="IsTransferred" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="TransferBaseStyle" TargetType="hc:Transfer">
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="2" />
<Setter Property="SelectionMode" Value="Extended"/>
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource TransferItemBaseStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Transfer">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="4" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
<hc:ToggleBlock.CheckedContent>
<hc:ScrollViewer IsInertiaEnabled="{Binding Path=(hc:ScrollViewer.IsInertiaEnabled),RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter />
</hc:ScrollViewer>
</hc:ToggleBlock.CheckedContent>
<hc:ToggleBlock.UnCheckedContent>
<hc:Empty />
</hc:ToggleBlock.UnCheckedContent>
</hc:ToggleBlock>
</Border>
<StackPanel Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.RowSpan="4" Grid.Column="1">
<Button hc:IconElement.Geometry="{StaticResource LeftGeometry}" Command="interactivity:ControlCommands.Cancel"/>
<Button hc:IconElement.Geometry="{StaticResource RightGeometry}" Margin="0,8,0,0" Command="interactivity:ControlCommands.Selected"/>
</StackPanel>
<ListBox x:Name="PART_SelectedListBox" Padding="{TemplateBinding Padding}" SelectionMode="{TemplateBinding SelectionMode}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}" ItemsPanel="{TemplateBinding ItemsPanel}" Grid.Row="0" Grid.RowSpan="4" Grid.Column="2" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>