Files
modernkeepass/ModernKeePass/Views/UserControls/ColorPickerUserControl.xaml

27 lines
1.3 KiB
XML

<UserControl x:Name="UserControl"
x:Class="ModernKeePass.Views.UserControls.ColorPickerUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ComboBox x:Name="ComboBox"
DataContext="{Binding Source={StaticResource Locator}, Path=ColorPicker}"
ItemsSource="{Binding Colors}"
SelectedItem="{Binding SelectedItem}"
SelectedValue="{Binding SelectedColor, ElementName=UserControl}"
SelectedValuePath="ColorBrush"
Loaded="ComboBox_OnLoaded"
SelectionChanged="ComboBox_OnSelectionChanged"
IsEnabled="{Binding IsEnabled, ElementName=UserControl}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,10,0">
<TextBlock Width="100" Text="{Binding ColorName}" Margin="0,0,10,0" />
<Rectangle Width="100" Fill="{Binding ColorBrush}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</UserControl>