ColorPicker vollständig + Delete Button
This commit is contained in:
@@ -2,25 +2,41 @@
|
||||
x:Class="BeWo.View.Controls.Utils.ColorPicker"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:BeWo.Controls.Controls;assembly=BeWo.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
|
||||
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
|
||||
xmlns:local="clr-namespace:BeWo.View.Controls.Utils"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="root"
|
||||
d:DesignHeight="50"
|
||||
d:DesignWidth="100"
|
||||
mc:Ignorable="d">
|
||||
<Grid Background="White">
|
||||
<Button
|
||||
x:Name="btn"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="24"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
dx:ThemeManager.ThemeName="None"
|
||||
Background="{Binding ElementName=root, Path=SelectedColor}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Click="button_select_color_Click"
|
||||
Style="{x:Null}" />
|
||||
Style="{x:Null}">
|
||||
<Grid Background="{Binding ElementName=root, Path=SelectedColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Margin="2"
|
||||
Grid.Column="1"
|
||||
x:Name="delete_btn"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Click="delete_btn_DeleteClick">
|
||||
X
|
||||
</Button>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Popup
|
||||
x:Name="popup_color"
|
||||
Placement="MousePoint"
|
||||
|
||||
@@ -60,11 +60,6 @@ namespace BeWo.View.Controls.Utils
|
||||
}
|
||||
}
|
||||
|
||||
private void button_select_color_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
popup_color.IsOpen = true;
|
||||
}
|
||||
|
||||
private void listbox_colorpicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.AddedItems.Count == 1)
|
||||
@@ -76,5 +71,18 @@ namespace BeWo.View.Controls.Utils
|
||||
popup_color.IsOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void button_select_color_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
popup_color.IsOpen = true;
|
||||
}
|
||||
|
||||
private void delete_btn_DeleteClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SelectedColor = null;
|
||||
listbox_colorpicker.SelectedItem = null;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user