| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:UI="clr-namespace:CustomUI">
- <Style TargetType="{x:Type UI:SegmentItem}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="BorderThickness" Value="1,0,0,0" />
- <Setter Property="Padding" Value="15,5" />
- <Setter Property="BorderBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UI:SegmentControl}}}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type UI:SegmentItem}">
- <Border
- x:Name="PART_ItemBorder"
- Padding="{TemplateBinding Padding}"
- Background="Transparent"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{TemplateBinding CornerRadius}"
- SnapsToDevicePixels="True"
- UseLayoutRounding="True">
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="Foreground" Value="White" />
- <Setter TargetName="PART_ItemBorder" Property="Background" Value="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
- </Trigger>
- <Trigger Property="IsFirstItem" Value="True">
- <Setter TargetName="PART_ItemBorder" Property="BorderThickness" Value="0" />
- </Trigger>
- <Trigger Property="IsLastItem" Value="True" />
- <Trigger Property="IsMiddleItem" Value="True" />
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF" />
- <SolidColorBrush x:Key="ListBox.Static.Border" Color="#0079FF" />
- <SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF" />
- <SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9" />
- <Style TargetType="{x:Type UI:SegmentControl}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="Padding" Value="-1,-1" />
- <Setter Property="Background" Value="{StaticResource ListBox.Static.Background}" />
- <Setter Property="BorderBrush" Value="{StaticResource ListBox.Static.Border}" />
- <Setter Property="BorderThickness" Value="1,1,1,1" />
- <Setter Property="Foreground" Value="Black" />
- <Setter Property="FontFamily" Value="微软雅黑" />
- <Setter Property="FontSize" Value="12" />
- <Setter Property="CornerRadius" Value="5" />
- <Setter Property="HorizontalAlignment" Value="Left" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
- <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
- <Setter Property="ScrollViewer.PanningMode" Value="Both" />
- <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type UI:SegmentControl}">
- <Border
- x:Name="Bd"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="{TemplateBinding CornerRadius}"
- SnapsToDevicePixels="true"
- UseLayoutRounding="True">
- <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
- <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </ScrollViewer>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="Bd" Property="Background" Value="{StaticResource ListBox.Disabled.Background}" />
- <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource ListBox.Disabled.Border}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <StackPanel IsItemsHost="True" Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|