<DataTemplate x:Key="ComboBoxItemTemplate" >
<Grid Height="45">
<TextBlock Text="{Binding }" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
<Grid x:Name="MainGrid" SnapsToDevicePixels="True">
<Popup x:Name="PART_Popup" AllowsTransparency="True" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
<Border x:Name="DropDownBorder" BorderBrush="#72919DB0" BorderThickness="1 0 1 1" CornerRadius="3" Background="{TemplateBinding Background}">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FF919DB0" Opacity="0.45"/>
</Border.Effect>
<ScrollViewer x:Name="DropDownScrollViewer">
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
</Popup>
<Border x:Name="Chrome" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}" CornerRadius="5" SnapsToDevicePixels="True">
<Grid>
<Grid HorizontalAlignment="Right" Width="50" Background="#f5f9fb">
<Path x:Name="Arrow" Data="M0,0L7,9 14,0z" Fill="#97afbf" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Toolkit:ImageCheckBox IsChecked="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
Background="Transparent" CheckedBackground="Transparent"/>
</Grid>
</Border>
<ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
<Setter Property="ItemTemplate" Value="{StaticResource ComboBoxItemTemplate}"/>
<Setter Property="BorderBrush" Value="#dddddd"/>
<Setter Property="Background" Value="Pink"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
ComboBox
最新推荐文章于 2019-05-02 16:26:00 发布