Files
2014-06-21 21:02:09 +08:00

43 lines
2.6 KiB
XML

<UserControl x:Class="ConfuserEx.CompComboBox"
x:Name="Root"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:Confuser.Core;assembly=Confuser.Core">
<ComboBox ItemsSource="{Binding Components, ElementName=Root}"
SelectedItem="{Binding SelectedComponent, ElementName=Root}"
DisplayMemberPath="Id" FontFamily="Consolas"
ScrollViewer.CanContentScroll="False">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Border Width="350" BorderBrush="{StaticResource Foreground}"
Background="{TemplateBinding Background}" BorderThickness="1" Margin="5">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Binding Name}" HorizontalAlignment="Left" />
<Label Grid.Row="0" Content="{Binding Id}" HorizontalAlignment="Right" />
<Label Grid.Row="1">
<TextBlock Text="{Binding Description}" TextTrimming="WordEllipsis"
FontSize="10" Foreground="Gray" />
</Label>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource HighlightBackground}" />
<Setter Property="Foreground" Value="{StaticResource SelectedForeground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
</UserControl>