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
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Tango.FSE.Common.Controls"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<Style TargetType="{x:Type local:SelectionComboBox}">
<Setter Property="Height" Value="26"></Setter>
<Setter Property="Width" Value="200"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:SelectionComboBox}">
<Border>
<Grid>
<Border Background="{TemplateBinding Background}" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextElement.Foreground="{StaticResource FSE_PrimaryForegroundBrush}">
<DockPanel>
<Button Style="{StaticResource FSE_FlatButton_OpacityHover}" x:Name="toggle" Width="30" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Foreground="Black">
<Path
Width="8" Height="8"
Margin="0 0 5 0"
Stretch="Uniform"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="M7,10L12,15L17,10H7Z"
Fill="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Foreground}" />
</Button>
<TextBlock VerticalAlignment="Center" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Margin="5">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0}{1}">
<Binding RelativeSource="{RelativeSource AncestorType=local:SelectionComboBox}" Path="ItemsSource.SynchedSource.Count"/>
<Binding Source=" Selected" />
</MultiBinding>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:SelectionComboBox},Path=ItemsSource.SynchedSource.Count}" Value="0">
<Setter Property="Text" Value="All Selected"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
</Border>
<Popup x:Name="popup" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=local:SelectionComboBox},Path=ActualWidth}" AllowsTransparency="True" StaysOpen="False">
<Border Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" Padding="3" CornerRadius="0 0 3 3" Margin="0 5 0 0">
<Border.Effect>
<DropShadowEffect Opacity="0.5" />
</Border.Effect>
<DockPanel>
<DockPanel Margin="0 2 0 5" DockPanel.Dock="Top">
<DockPanel>
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Magnify" Foreground="{StaticResource FSE_GrayBrush}" />
<TextBox x:Name="filterTextBox" Style="{StaticResource FSE_Rounded_Corners_TextBox}" Text="{Binding RelativeSource={RelativeSource AncestorType=local:SelectionComboBox},Path=Filter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</DockPanel>
</DockPanel>
<DockPanel Margin="2 0 0 5" DockPanel.Dock="Top">
<CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorType=local:SelectionComboBox},Path=AllSelected}" />
<TextBlock VerticalAlignment="Center" Margin="7 0 0 0" Text="All"></TextBlock>
</DockPanel>
<ListBox Style="{StaticResource FSE_BlankListBox}" Padding="0" Margin="0" BorderThickness="0" HorizontalAlignment="Stretch" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:SelectionComboBox},Path=ItemsSource}" MaxHeight="200" DisplayMemberPath="Data" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel Margin="2">
<CheckBox IsChecked="{Binding IsSelected,Mode=TwoWay}">
<CheckBox.Content>
<TextBlock VerticalAlignment="Center" Margin="5 0 0 0">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource DisplayMemberPathToStringConverter}">
<Binding Path="Data" />
<Binding RelativeSource="{RelativeSource AncestorType=local:SelectionComboBox}" Path="DisplayMemberPath" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</CheckBox.Content>
</CheckBox>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|