aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/MaterialDesignInXamlToolkit-master/MahMaterialDragablzMashUp/PaletteSelector.xaml
blob: 93544f39f4a6cbee7b194e6fecc9a761384e1a56 (plain)
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
<UserControl x:Class="MahMaterialDragablzMashUp.PaletteSelector"
             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:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
             xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
             xmlns:mahMaterialDragablzMashUp="clr-namespace:MahMaterialDragablzMashUp"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{d:DesignInstance mahMaterialDragablzMashUp:PaletteSelectorViewModel, IsDesignTimeCreatable=False}">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
            <Setter Property="Margin" Value="0" />
            <Setter Property="CommandParameter" Value="{Binding}" />
            <Setter Property="VerticalAlignment" Value="Stretch" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="Foreground">
                <Setter.Value>
                    <SolidColorBrush Color="{Binding ExemplarHue.Foreground, Mode=OneTime}" />
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="PalettePath" TargetType="Path">
            <Setter Property="Data" Value="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" />
            <Setter Property="Fill">
                <Setter.Value>
                    <SolidColorBrush Color="{Binding ExemplarHue.Foreground, Mode=OneTime}" />
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate DataType="{x:Type materialDesignColors:Swatch}">
            <wpf:Card Margin="4" Width="240">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding Name}" Margin="8" Grid.ColumnSpan="2" />
                    <Border Grid.Row="1" Grid.Column="0" MinWidth="120">
                        <Border.Background>
                            <SolidColorBrush Color="{Binding ExemplarHue.Color, Mode=OneTime}" />
                        </Border.Background>
                        <Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mahMaterialDragablzMashUp:PaletteSelector}}, Path=DataContext.ApplyPrimaryCommand, Mode=OneTime}"
                                CommandParameter="{Binding}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Primary" />
                                <Viewbox Width="16" Height="16">
                                    <Canvas Width="24" Height="24">
                                        <Path Style="{StaticResource PalettePath}" />
                                    </Canvas>
                                </Viewbox>
                            </StackPanel>
                        </Button>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="1" 
                                        Visibility="{Binding IsAccented, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneTime}"
                                        Width="120">
                        <Border.Background>
                            <SolidColorBrush Color="{Binding AccentExemplarHue.Color, Mode=OneTime}" />
                        </Border.Background>
                        <Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mahMaterialDragablzMashUp:PaletteSelector}}, Path=DataContext.ApplyAccentCommand, Mode=OneTime}"
                                CommandParameter="{Binding}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Accent" />
                                <Viewbox Width="16" Height="16">
                                    <Canvas Width="24" Height="24">
                                        <Path Style="{StaticResource PalettePath}" />
                                    </Canvas>
                                </Viewbox>
                            </StackPanel>
                        </Button>
                    </Border>
                </Grid>
            </wpf:Card>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid HorizontalAlignment="Left" Margin="16 0 0 4">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock VerticalAlignment="Center">Standard Style</TextBlock>
            <ToggleButton Grid.Column="1" Margin="8 4 16 4" Command="{Binding ToggleStyleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" />
            <TextBlock Grid.Column="2" VerticalAlignment="Center">Alternate Style</TextBlock>
            <TextBlock Grid.Row="1" VerticalAlignment="Center">Light</TextBlock>
            <ToggleButton Grid.Row="1" Grid.Column="1" Margin="8 4 16 4" Command="{Binding ToggleBaseCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" />
            <TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">Dark</TextBlock>
        </Grid>
        <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
            <ItemsControl ItemsSource="{Binding Swatches, Mode=OneTime}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</UserControl>