12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <!--默认样式-->
- <Style BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox"/>
- <Style x:Key="ListBoxItemBaseStyle.Small" BasedOn="{StaticResource ListBoxItemBaseStyle}" TargetType="ListBoxItem">
- <Setter Property="Padding" Value="6,0"/>
- <Setter Property="MinHeight" Value="24"/>
- </Style>
- <Style x:Key="ListBox.Small" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
- <Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemBaseStyle.Small}"/>
- </Style>
- <Style x:Key="ListBoxItemCustom" TargetType="ListBoxItem">
- <Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="Padding" Value="0"/>
- <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
- <Setter Property="VerticalContentAlignment" Value="Top"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ListBoxItem">
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ListBoxCustom" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
- <Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemCustom}"/>
- <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
- </Style>
- <Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
- <Setter Property="ItemsPanel" Value="{StaticResource WrapHorizontalItemsPanelTemplate}"/>
- </Style>
- <Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
- <Setter Property="ItemsPanel" Value="{StaticResource WrapVerticalItemsPanelTemplate}"/>
- </Style>
- <Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
- <Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}"/>
- </Style>
- <Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
- <Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}"/>
- </Style>
- </ResourceDictionary>
|