1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
<Style x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
<Setter Property="Background" >
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FF8E8E8E" Offset="0"></GradientStop>
<GradientStop Color="#FFCCCCCC" Offset="1"></GradientStop>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsChecked" Value="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
<Setter Property="ClickMode" Value="Press"/>
<Setter Property="Content" Value="V"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="MS Sans Serif"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FFCCCCCC" Offset="0"></GradientStop>
<GradientStop Color="#FFA2A2A2" Offset="1"></GradientStop>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FFD4D0C8"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="#FF8E8E8E"></Setter>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="MS Sans Serif"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="FontFamily" Value="MS Sans Serif"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#FF8E8E8E"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Margin" Value="5,2,5,2"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid x:Name="GridComboBox">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="24"/>
</Grid.ColumnDefinitions>
<Border x:Name="TextBorder" CornerRadius="3,0,0,3" BorderBrush="White" BorderThickness="1">
<ContentPresenter
x:Name="TextContentPresenter"
Grid.Column="0"
TextBlock.FontFamily="MS Sans Serif"
TextBlock.FontSize="12"
TextBlock.Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
</Border>
<!--<ToggleButton ClickMode="Press" Background="Transparent"/>-->
<Border Grid.Column="1" CornerRadius="0,3,3,0" BorderBrush="White" BorderThickness="1">
<ToggleButton Style="{StaticResource ComboBoxToggleButton}"/>
</Border>
<!---->
<Popup Width="{Binding ActualWidth, ElementName=GridComboBox}" Name="PopupCB"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
Focusable="False"
AllowsTransparency="True"
PopupAnimation="Slide">
<Border BorderThickness="1,1,1,1" CornerRadius="0,0,5,5" BorderBrush="White" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" Name="DropDownBorder">
<ScrollViewer>
<ItemsPresenter
TextBlock.FontFamily="MS Sans Serif"
TextBlock.FontSize="12"
TextBlock.Foreground="White"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="TextBorder" Property="Background" Value="#FFD4D0C8"/>
<Setter TargetName="TextContentPresenter" Property="TextBlock.Foreground" Value="Black"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter> |
Partager