<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ctrl="clr-namespace:Elwig.Controls"> <ctrl:VisibilityConverter x:Key="VisibilityConverter"/> <Style TargetType="ctrl:CheckComboBox" BasedOn="{StaticResource {x:Type ListBox}}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ctrl:CheckComboBox"> <Grid Style="{x:Null}"> <Button x:Name="Button" ClickMode="Press" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="White"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"> <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Button.Style> <Path x:Name="IconDropdown" Data="M 0,0 L 3,3 L 6,0" Stroke="#FF606060" StrokeThickness="1" Margin="0,0,5,0" HorizontalAlignment="Right" VerticalAlignment="Center"/> </Button> <TextBlock x:Name="TextBox" Style="{x:Null}" Margin="6,0,18,0" IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> <Popup x:Name="Popup" Placement="Bottom" Focusable="True" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="Slide" AllowsTransparency="True"> <Popup.Style> <Style TargetType="{x:Type Popup}"> <Setter Property="StaysOpen" Value="False"/> <Style.Triggers> <DataTrigger Binding="{Binding IsMouseOver, ElementName=Button}" Value="True"> <Setter Property="StaysOpen" Value="True"/> </DataTrigger> <DataTrigger Binding="{Binding IsMouseOver, ElementName=Border}" Value="True"> <Setter Property="StaysOpen" Value="True"/> </DataTrigger> </Style.Triggers> </Style> </Popup.Style> <Border x:Name="Border" Style="{x:Null}" BorderThickness="1" BorderBrush="Gray" Background="White" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> <DockPanel> <ListBoxItem x:Name="SelectAllItem" Padding="2,1,2,1" DockPanel.Dock="Top" Visibility="{TemplateBinding IsSelectAllActive, Converter={StaticResource VisibilityConverter}}"> <StackPanel Orientation="Horizontal"> <CheckBox VerticalAlignment="Center" Margin="0,0,5,0" IsThreeState="True" IsChecked="{Binding AllItemsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/> <TextBlock Text="{TemplateBinding SelectAllContent}" VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/> </StackPanel> </ListBoxItem> <ScrollViewer Style="{x:Null}"> <StackPanel Style="{x:Null}" IsItemsHost="True" SnapsToDevicePixels="True" KeyboardNavigation.DirectionalNavigation="Contained"/> </ScrollViewer> </DockPanel> </Border> </Popup> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="IconDropdown" Property="Stroke" Value="#FFA0A0A0"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="IconDropdown" Property="Stroke" Value="Black"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="2,1,2,1"> <StackPanel Orientation="Horizontal"> <CheckBox VerticalAlignment="Center" Margin="0,0,5,0" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"/> <ContentPresenter VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/> </StackPanel> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="BorderThickness" Value="1"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" Value="#FF70C0E7"/> <Setter Property="Background" Value="#FFE5F3FB"/> </Trigger> </Style.Triggers> </Style> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="Gray"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" Value="#FF7EB4EA"/> </Trigger> </Style.Triggers> </Style> </ResourceDictionary>