1+ <ResourceDictionary xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+ xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml" >
3+
4+
5+ <Style x : Key =" ComboBoxToggleButton" TargetType =" {x:Type ToggleButton}" >
6+ <Setter Property =" IsTabStop" Value =" false" />
7+ <Setter Property =" Focusable" Value =" false" />
8+ <Setter Property =" ClickMode" Value =" Press" />
9+ <Setter Property =" Template" >
10+ <Setter .Value>
11+ <ControlTemplate TargetType =" {x:Type ToggleButton}" >
12+ <Border BorderBrush =" {TemplateBinding BorderBrush}"
13+ BorderThickness =" {TemplateBinding BorderThickness}"
14+ Background =" {TemplateBinding Background}" >
15+ <Border x : Name =" InnerBorder" BorderBrush =" Transparent"
16+ HorizontalAlignment =" Right" Margin =" 0" SnapsToDevicePixels =" true" Width =" {DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" >
17+ <Polygon x : Name =" arrow"
18+ Points =" 0,0 8,0 4,5"
19+ Fill =" {TemplateBinding Foreground}"
20+ HorizontalAlignment =" Center"
21+ VerticalAlignment =" Center" />
22+ </Border >
23+ </Border >
24+ <ControlTemplate .Triggers>
25+ <Trigger Property =" IsMouseOver" Value =" True" >
26+ <Setter Property =" Background" TargetName =" InnerBorder" Value =" {StaticResource ButtonMouseOverBackgroundBrush}" />
27+ </Trigger >
28+ <Trigger Property =" IsPressed" Value =" true" >
29+ <Setter Property =" Background" TargetName =" InnerBorder" Value =" {StaticResource ButtonIsPressedBackgroundBrush}" />
30+ </Trigger >
31+ <Trigger Property =" IsEnabled" Value =" false" >
32+ <Setter Property =" Fill" TargetName =" arrow" Value =" {StaticResource DisabledForegroundBrush}" />
33+ </Trigger >
34+ </ControlTemplate .Triggers>
35+ </ControlTemplate >
36+ </Setter .Value>
37+ </Setter >
38+ </Style >
39+
40+ <Style TargetType =" {x:Type ComboBox}" >
41+ <Setter Property =" Foreground" Value =" {StaticResource DefaultForegroundBrush}" />
42+ <Setter Property =" Background" Value =" {StaticResource DefaultBackgroundBrush}" />
43+ <Setter Property =" BorderBrush" Value =" {StaticResource DefaultBorderBrush}" />
44+ <Setter Property =" BorderThickness" Value =" 1" />
45+ <Setter Property =" ScrollViewer.HorizontalScrollBarVisibility" Value =" Auto" />
46+ <Setter Property =" ScrollViewer.VerticalScrollBarVisibility" Value =" Auto" />
47+ <Setter Property =" Padding" Value =" 6,3,5,3" />
48+ <Setter Property =" ScrollViewer.CanContentScroll" Value =" true" />
49+ <Setter Property =" ScrollViewer.PanningMode" Value =" Both" />
50+ <Setter Property =" Template" >
51+ <Setter .Value>
52+ <ControlTemplate TargetType =" {x:Type ComboBox}" >
53+ <Grid x : Name =" templateRoot" SnapsToDevicePixels =" true" >
54+ <Grid .ColumnDefinitions>
55+ <ColumnDefinition Width =" *" />
56+ <ColumnDefinition MinWidth =" {DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width =" 0" />
57+ </Grid .ColumnDefinitions>
58+ <Popup x : Name =" PART_Popup" AllowsTransparency =" true" Grid.ColumnSpan=" 2" IsOpen =" {Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin =" 1" PopupAnimation =" {DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement =" Bottom" >
59+ <Border x : Name =" dropDownBorder" BorderBrush =" {DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness =" 1" Background =" {DynamicResource {x:Static SystemColors.WindowBrushKey}}" >
60+ <ScrollViewer x : Name =" DropDownScrollViewer" >
61+ <Grid x : Name =" grid" RenderOptions.ClearTypeHint=" Enabled" >
62+ <Canvas x : Name =" canvas" HorizontalAlignment =" Left" Height =" 0" VerticalAlignment =" Top" Width =" 0" >
63+ <Rectangle x : Name =" opaqueRect" Fill =" {Binding Background, ElementName=dropDownBorder}" Height =" {Binding ActualHeight, ElementName=dropDownBorder}" Width =" {Binding ActualWidth, ElementName=dropDownBorder}" />
64+ </Canvas >
65+ <ItemsPresenter x : Name =" ItemsPresenter" KeyboardNavigation.DirectionalNavigation=" Contained" SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}" />
66+ </Grid >
67+ </ScrollViewer >
68+ </Border >
69+ </Popup >
70+ <ToggleButton x : Name =" toggleButton" BorderBrush =" {TemplateBinding BorderBrush}"
71+ BorderThickness =" {TemplateBinding BorderThickness}"
72+ Background =" {TemplateBinding Background}"
73+ Foreground =" {TemplateBinding Foreground}"
74+ Grid.ColumnSpan=" 2"
75+ IsChecked =" {Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
76+ Style =" {StaticResource ComboBoxToggleButton}" />
77+ <ContentPresenter x : Name =" contentPresenter" ContentTemplate =" {TemplateBinding SelectionBoxItemTemplate}"
78+ ContentTemplateSelector =" {TemplateBinding ItemTemplateSelector}"
79+ Content =" {TemplateBinding SelectionBoxItem}"
80+ ContentStringFormat =" {TemplateBinding SelectionBoxItemStringFormat}"
81+ HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}"
82+ IsHitTestVisible =" false" Margin =" {TemplateBinding Padding}"
83+ SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}" VerticalAlignment =" {TemplateBinding VerticalContentAlignment}" />
84+ </Grid >
85+ <ControlTemplate .Triggers>
86+ <Trigger Property =" HasItems" Value =" false" >
87+ <Setter Property =" Height" TargetName =" dropDownBorder" Value =" 95" />
88+ </Trigger >
89+ <Trigger Property =" IsEnabled" Value =" False" >
90+ <Setter Property =" Background" Value =" #101010" />
91+ </Trigger >
92+ <MultiTrigger >
93+ <MultiTrigger .Conditions>
94+ <Condition Property =" IsGrouping" Value =" true" />
95+ <Condition Property =" VirtualizingPanel.IsVirtualizingWhenGrouping" Value =" false" />
96+ </MultiTrigger .Conditions>
97+ <Setter Property =" ScrollViewer.CanContentScroll" Value =" false" />
98+ </MultiTrigger >
99+ <Trigger Property =" ScrollViewer.CanContentScroll" SourceName =" DropDownScrollViewer" Value =" false" >
100+ <Setter Property =" Canvas.Top" TargetName =" opaqueRect" Value =" {Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
101+ <Setter Property =" Canvas.Left" TargetName =" opaqueRect" Value =" {Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
102+ </Trigger >
103+ </ControlTemplate .Triggers>
104+ </ControlTemplate >
105+ </Setter .Value>
106+ </Setter >
107+ <Setter Property =" ItemContainerStyle" >
108+ <Setter .Value>
109+ <Style TargetType =" ComboBoxItem" >
110+ <Setter Property =" Foreground" Value =" {StaticResource DefaultForegroundBrush}" />
111+ <Setter Property =" Background" Value =" {StaticResource DefaultBackgroundBrush}" />
112+ <Setter Property =" BorderBrush" Value =" {StaticResource DefaultBackgroundBrush}" />
113+ </Style >
114+ </Setter .Value>
115+ </Setter >
116+ </Style >
117+ </ResourceDictionary >
0 commit comments