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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:Tango.SharedUI.Controls">
<local:MultiSelectComboBoxTemplateSelector x:Key="MultiSelectComboBoxTemplateSelector" />
<Style TargetType="{x:Type local:MultiSelectComboBox}">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBox}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="MultiSelToggleButton" Grid.Column="0" MinHeight="40" Height="Auto"
VerticalAlignment="Center"
HorizontalAlignment="Stretch" Margin="4,0,0,0" SnapsToDevicePixels="True"
Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"
IsChecked="{Binding IsToggleChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
>
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Grid x:Name="grid" >
<ScrollViewer VerticalScrollBarVisibility="Auto" >
<ScrollViewer.Resources>
<Style TargetType="ScrollBar">
<Setter Property="Width" Value="6"/>
<Setter Property="MinWidth" Value="6" />
</Style>
</ScrollViewer.Resources>
<ItemsControl x:Name="SelectedItemsControl" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=SelectedItemsList}"
ItemTemplateSelector="{StaticResource MultiSelectComboBoxTemplateSelector}" MinHeight="20" VerticalAlignment="Stretch">
<ItemsControl.Resources>
<DataTemplate x:Key="CheckItem">
<Button Margin="2" Height="25" Width="Auto" Background="Transparent" BorderThickness="0.5" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=BorderBrush}"
Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=RemoveItemCommand}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}" VerticalAlignment="Center" Margin="2"/>
<Image Source="/Tango.SharedUI;component/Images/PinClose_Black.png" Width="10" Margin="2 2 2 0" VerticalAlignment="Center" HorizontalAlignment="Right" />
</StackPanel>
</Button>
</DataTemplate>
<DataTemplate x:Key="SearchItem">
<TextBox x:Name="Edit_PART" Height="25" MinWidth="20" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" BorderBrush="Transparent" VerticalContentAlignment="Center" BorderThickness="0"
Text="{Binding Text}" Margin="2" Background="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}"/>
</DataTemplate>
</ItemsControl.Resources>
<ItemsControl.Template>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<ItemsPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
</Grid>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Button Grid.Column=" 1" BorderBrush="Transparent" Opacity="0.2" VerticalContentAlignment="Top" Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=RemoveAllCommand}" Width="20">
<Grid VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="15" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="/Tango.SharedUI;component/Images/PinClose_Black.png" MinWidth="10" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
</Grid>
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<EventTrigger RoutedEvent="Control.MouseEnter">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Duration="0:0:1" To="1" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Control.MouseLeave">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Duration="0:0:1" To="0.05" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Popup x:Name="MultiSel_Popup" Tag="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}}" MinHeight="25" MaxHeight="600" HorizontalOffset="0" MinWidth="{TemplateBinding ActualWidth}" MaxWidth="800" Grid.ColumnSpan="2"
PlacementTarget="{Binding ElementName=MultiSelToggleButton}" Placement="Bottom" AllowsTransparency="True"
IsOpen="{Binding ElementName=MultiSelToggleButton,Path=IsChecked}" StaysOpen="True" PopupAnimation="Slide" >
<Border Opacity="1" Background="{TemplateBinding Background}" Padding="3" BorderThickness="1" BorderBrush="Beige">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
<ItemsControl x:Name="PropertyDisplay" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=SearchItemsList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Margin="4,2" Height="Auto" Width="Auto" Background="Transparent" BorderThickness="0.5" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=BorderBrush}"
Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=AddItemCommand}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}" VerticalAlignment="Center" />
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type local:RangeProgressBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:RangeProgressBar}">
<Border x:Name="PART_OuterBorder" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border x:Name="PART_InnerBorder" Background="{TemplateBinding FillBrush}">
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|