TransferBaseStyle.xaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls"
  4. xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
  5. <Style x:Key="TransferItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:TransferItem">
  6. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualMargin0}" />
  7. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  8. <Setter Property="Background" Value="{DynamicResource RegionBrush}" />
  9. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
  10. <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
  11. <Setter Property="Template">
  12. <Setter.Value>
  13. <ControlTemplate TargetType="hc:TransferItem">
  14. <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">
  15. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  16. </Border>
  17. </ControlTemplate>
  18. </Setter.Value>
  19. </Setter>
  20. <Style.Triggers>
  21. <Trigger Property="IsMouseOver" Value="True">
  22. <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
  23. </Trigger>
  24. <Trigger Property="IsSelected" Value="True">
  25. <Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
  26. <Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}" />
  27. </Trigger>
  28. <Trigger Property="IsTransferred" Value="True">
  29. <Setter Property="Visibility" Value="Collapsed" />
  30. </Trigger>
  31. </Style.Triggers>
  32. </Style>
  33. <Style x:Key="TransferBaseStyle" TargetType="hc:Transfer">
  34. <Setter Property="Focusable" Value="False"/>
  35. <Setter Property="BorderThickness" Value="1"/>
  36. <Setter Property="Padding" Value="2" />
  37. <Setter Property="SelectionMode" Value="Extended"/>
  38. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  39. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  40. <Setter Property="ItemContainerStyle" Value="{StaticResource TransferItemBaseStyle}"/>
  41. <Setter Property="Template">
  42. <Setter.Value>
  43. <ControlTemplate TargetType="hc:Transfer">
  44. <Grid>
  45. <Grid.ColumnDefinitions>
  46. <ColumnDefinition />
  47. <ColumnDefinition Width="Auto"/>
  48. <ColumnDefinition />
  49. </Grid.ColumnDefinitions>
  50. <Grid.RowDefinitions>
  51. <RowDefinition/>
  52. <RowDefinition/>
  53. <RowDefinition/>
  54. <RowDefinition/>
  55. </Grid.RowDefinitions>
  56. <Border Grid.RowSpan="4" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
  57. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  58. <hc:ToggleBlock.CheckedContent>
  59. <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}">
  60. <ItemsPresenter />
  61. </hc:ScrollViewer>
  62. </hc:ToggleBlock.CheckedContent>
  63. <hc:ToggleBlock.UnCheckedContent>
  64. <hc:Empty />
  65. </hc:ToggleBlock.UnCheckedContent>
  66. </hc:ToggleBlock>
  67. </Border>
  68. <StackPanel Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.RowSpan="4" Grid.Column="1">
  69. <Button hc:IconElement.Geometry="{StaticResource LeftGeometry}" Command="interactivity:ControlCommands.Cancel"/>
  70. <Button hc:IconElement.Geometry="{StaticResource RightGeometry}" Margin="0,8,0,0" Command="interactivity:ControlCommands.Selected"/>
  71. </StackPanel>
  72. <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}" />
  73. </Grid>
  74. </ControlTemplate>
  75. </Setter.Value>
  76. </Setter>
  77. </Style>
  78. </ResourceDictionary>