-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorList.xaml
More file actions
48 lines (48 loc) · 2.97 KB
/
ColorList.xaml
File metadata and controls
48 lines (48 loc) · 2.97 KB
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
<UserControl x:Class="AdvancedColorPicker.ColorList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:models="clr-namespace:AdvancedColorPicker.Models"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<ListBox DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" ItemsSource="{Binding Colors}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True"></WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="models:ColorEntry">
<Grid Margin="10" x:Name="Grid">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto" SharedSizeGroup="Col2"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Rectangle Grid.RowSpan="2" Width="40" Height="40" Margin="8" ToolTip="Click to copy hex code" PreviewMouseLeftButtonDown="Rectangle_MouseDown">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Color}"></SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Name}"></TextBox>
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Text="{Binding ColorPickDate}"></TextBlock>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="2" Orientation="Horizontal">
<Button Style="{DynamicResource MaterialDesignFlatButton}" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=RemoveColorFromThemeCommand}" CommandParameter="{Binding}">Delete Color</Button>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</UserControl>