[#37] Controls: Implement CheckComboBox and remove xctk
All checks were successful
Test / Run tests (push) Successful in 2m26s

This commit is contained in:
2024-06-12 16:29:57 +02:00
parent 6fc38b9db0
commit 4483eb6a69
16 changed files with 308 additions and 94 deletions

View File

@ -0,0 +1,106 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace Elwig.Controls {
public class CheckComboBox : ListBox {
public static readonly DependencyProperty DelimiterProperty = DependencyProperty.Register("Delimiter", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata(", "));
public string Delimiter {
get => (string)GetValue(DelimiterProperty);
set => SetValue(DelimiterProperty, value);
}
public static readonly DependencyProperty AllItemsSelectedContentProperty = DependencyProperty.Register("AllItemsSelectedContent", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata("All"));
public string AllItemsSelectedContent {
get => (string)GetValue(AllItemsSelectedContentProperty);
set => SetValue(AllItemsSelectedContentProperty, value);
}
public static readonly DependencyProperty IsSelectAllActiveProperty = DependencyProperty.Register("IsSelectAllActive", typeof(bool), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool IsSelectAllActive {
get => (bool)GetValue(IsSelectAllActiveProperty);
set => SetValue(IsSelectAllActiveProperty, value);
}
public static readonly DependencyProperty SelectAllContentProperty = DependencyProperty.Register("SelectAllContent", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata("All"));
public string SelectAllContent {
get => (string)GetValue(SelectAllContentProperty);
set => SetValue(SelectAllContentProperty, value);
}
public static readonly DependencyProperty AllItemsSelectedProperty = DependencyProperty.Register("AllItemsSelected", typeof(bool?), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool? AllItemsSelected {
get => (bool?)GetValue(AllItemsSelectedProperty);
set => SetValue(AllItemsSelectedProperty, value);
}
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool IsDropDownOpen {
get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
}
public static readonly DependencyProperty MaxDropDownHeightProperty = DependencyProperty.Register("MaxDropDownHeight", typeof(double), typeof(CheckComboBox), new FrameworkPropertyMetadata(ComboBox.MaxDropDownHeightProperty.DefaultMetadata.DefaultValue));
public double MaxDropDownHeight {
get => (double)GetValue(MaxDropDownHeightProperty);
set => SetValue(MaxDropDownHeightProperty, value);
}
static CheckComboBox() {
DefaultStyleKeyProperty.OverrideMetadata(typeof(CheckComboBox), new FrameworkPropertyMetadata(typeof(CheckComboBox)));
}
private TextBlock TextBox;
public CheckComboBox() {
SelectionMode = SelectionMode.Multiple;
}
public override void OnApplyTemplate() {
TextBox = (GetTemplateChild("TextBox") as TextBlock)!;
var button = GetTemplateChild("Button") as Button;
button!.Click += Button_MouseDown;
var item = GetTemplateChild("SelectAllItem") as ListBoxItem;
item!.PreviewMouseDown += SelectAllItem_MouseDown;
SelectionChanged += OnSelectionChanged;
IsEnabledChanged += OnIsEnabledChanged;
base.OnApplyTemplate();
}
private void Button_MouseDown(object sender, RoutedEventArgs evt) {
IsDropDownOpen = !IsDropDownOpen;
}
private void SelectAllItem_MouseDown(object sender, RoutedEventArgs evt) {
if (AllItemsSelected == false) {
SelectAll();
} else {
UnselectAll();
}
evt.Handled = true;
}
private void OnSelectionChanged(object sender, SelectionChangedEventArgs evt) {
var dmp = DisplayMemberPath != null && DisplayMemberPath != "" ? DisplayMemberPath : null;
if (SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
TextBox.Text = AllItemsSelectedContent;
AllItemsSelected = true;
} else if (SelectedItems.Count == 0) {
TextBox.Text = "";
AllItemsSelected = false;
} else {
TextBox.Text = string.Join(Delimiter,
dmp == null ? SelectedItems.Cast<object>() :
SelectedItems.Cast<object>()
.Select(i => i.GetType().GetProperty(dmp)?.GetValue(i))
);
AllItemsSelected = null;
}
}
private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs evt) {
if (!IsEnabled) IsDropDownOpen = false;
}
}
}

View File

@ -0,0 +1,118 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrl="clr-namespace:Elwig.Controls">
<ctrl:VisibilityConverter x:Key="VisibilityConverter"/>
<Style TargetType="ctrl:CheckComboBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:CheckComboBox">
<Grid Style="{x:Null}">
<Button x:Name="Button" ClickMode="Press" BorderThickness="1"
BorderBrush="{TemplateBinding BorderBrush}"
IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
<Path x:Name="IconDropdown" Data="M 0,0 L 3,3 L 6,0" Stroke="#FF606060" StrokeThickness="1" Margin="0,0,5,0"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
</Button>
<TextBlock x:Name="TextBox" Style="{x:Null}" Margin="6,0,18,0" IsHitTestVisible="False"
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<Popup x:Name="Popup" Placement="Bottom" Focusable="True"
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
PopupAnimation="Slide" AllowsTransparency="True">
<Popup.Style>
<Style TargetType="{x:Type Popup}">
<Setter Property="StaysOpen" Value="False"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=Button}" Value="True">
<Setter Property="StaysOpen" Value="True"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=Border}" Value="True">
<Setter Property="StaysOpen" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<Border x:Name="Border" Style="{x:Null}" BorderThickness="1" BorderBrush="Gray" Background="White" SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<DockPanel>
<ListBoxItem x:Name="SelectAllItem" Padding="2,1,2,1" DockPanel.Dock="Top"
Visibility="{TemplateBinding IsSelectAllActive, Converter={StaticResource VisibilityConverter}}">
<StackPanel Orientation="Horizontal">
<CheckBox VerticalAlignment="Center" Margin="0,0,5,0" IsThreeState="True"
IsChecked="{Binding AllItemsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
<TextBlock Text="{TemplateBinding SelectAllContent}" VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/>
</StackPanel>
</ListBoxItem>
<ScrollViewer Style="{x:Null}">
<StackPanel Style="{x:Null}" IsItemsHost="True" SnapsToDevicePixels="True"
KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</DockPanel>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="IconDropdown" Property="Stroke" Value="#FFA0A0A0"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="IconDropdown" Property="Stroke" Value="Black"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="2,1,2,1">
<StackPanel Orientation="Horizontal">
<CheckBox VerticalAlignment="Center" Margin="0,0,5,0"
IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"/>
<ContentPresenter VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#FF70C0E7"/>
<Setter Property="Background" Value="#FFE5F3FB"/>
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#FF7EB4EA"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,16 @@
using System;
using System.Windows;
using System.Windows.Data;
using System.Globalization;
namespace Elwig.Controls {
public class VisibilityConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
return (Visibility)value == Visibility.Visible;
}
}
}

View File

@ -25,7 +25,6 @@
</Target> </Target>
<ItemGroup> <ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
<PackageReference Include="LinqKit" Version="1.2.5" /> <PackageReference Include="LinqKit" Version="1.2.5" />
<PackageReference Include="MailKit" Version="4.6.0" /> <PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" /> <PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />

View File

@ -102,20 +102,6 @@ namespace Elwig.Helpers {
selector.SelectedItem = selItem; selector.SelectedItem = selItem;
} }
public static void RenewItemsSource(Xceed.Wpf.Toolkit.Primitives.Selector selector, IEnumerable? source, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventHandler? handler = null) {
if (selector.ItemsSource == source)
return;
var selectedIds = selector.SelectedItems.Cast<object>().Select(i => Utils.GetEntityIdentifier(i)).ToList();
if (handler != null && selectedIds != null) selector.ItemSelectionChanged -= handler;
selector.ItemsSource = source;
if (source != null) {
selector.SelectedItems.Clear();
foreach (var i in source.Cast<object>().Where(i => selectedIds.Contains(Utils.GetEntityIdentifier(i))))
selector.SelectedItems.Add(i);
}
if (handler != null && selectedIds != null) selector.ItemSelectionChanged += handler;
}
public static void RenewItemsSource(DataGrid dataGrid, IEnumerable? source, SelectionChangedEventHandler? handler = null, RenewSourceDefault def = RenewSourceDefault.None, bool keepSort = true) { public static void RenewItemsSource(DataGrid dataGrid, IEnumerable? source, SelectionChangedEventHandler? handler = null, RenewSourceDefault def = RenewSourceDefault.None, bool keepSort = true) {
if (dataGrid.ItemsSource == source) if (dataGrid.ItemsSource == source)
return; return;
@ -210,15 +196,15 @@ namespace Elwig.Helpers {
return GetItemsFromSource(source, items.Select(Utils.GetEntityIdentifier)); return GetItemsFromSource(source, items.Select(Utils.GetEntityIdentifier));
} }
public static void SelectItems(Xceed.Wpf.Toolkit.CheckComboBox ccb, IEnumerable<int?>? ids) { public static void SelectItems(ListBox lb, IEnumerable<int?>? ids) {
ccb.SelectedItems.Clear(); lb.SelectedItems.Clear();
if (ids == null) return; if (ids == null) return;
foreach (var id in ids) foreach (var id in ids)
ccb.SelectedItems.Add(GetItemFromSource(ccb.ItemsSource, id)); lb.SelectedItems.Add(GetItemFromSource(lb.ItemsSource, id));
} }
public static void SelectItems(Xceed.Wpf.Toolkit.CheckComboBox ccb, IEnumerable<object>? items) { public static void SelectItems(ListBox lb, IEnumerable<object>? items) {
SelectItems(ccb, items?.Select(Utils.GetEntityIdentifier)); SelectItems(lb, items?.Select(Utils.GetEntityIdentifier));
} }
public static int? GetInputHashCode(Control input) { public static int? GetInputHashCode(Control input) {
@ -226,8 +212,8 @@ namespace Elwig.Helpers {
return Utils.GetEntityIdentifier(tb.Text); return Utils.GetEntityIdentifier(tb.Text);
} else if (input is ComboBox sb) { } else if (input is ComboBox sb) {
return Utils.GetEntityIdentifier(sb.SelectedItem); return Utils.GetEntityIdentifier(sb.SelectedItem);
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) { } else if (input is ListBox lb) {
return Utils.GetEntityIdentifier(ccb.SelectedItems); return Utils.GetEntityIdentifier(lb.SelectedItems);
} else if (input is CheckBox cb) { } else if (input is CheckBox cb) {
return Utils.GetEntityIdentifier(cb.IsChecked); return Utils.GetEntityIdentifier(cb.IsChecked);
} else if (input is RadioButton rb) { } else if (input is RadioButton rb) {

View File

@ -2,5 +2,6 @@
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Elwig;component/Controls/UnitTextBox.xaml"/> <ResourceDictionary Source="/Elwig;component/Controls/UnitTextBox.xaml"/>
<ResourceDictionary Source="/Elwig;component/Controls/IntegerUpDown.xaml"/> <ResourceDictionary Source="/Elwig;component/Controls/IntegerUpDown.xaml"/>
<ResourceDictionary Source="/Elwig;component/Controls/CheckComboBox.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,4 +1,3 @@
using Elwig.Controls;
using Elwig.Helpers; using Elwig.Helpers;
using Elwig.Models.Entities; using Elwig.Models.Entities;
using System; using System;
@ -10,7 +9,6 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Threading; using System.Windows.Threading;
using Xceed.Wpf.Toolkit;
using System.Windows.Input; using System.Windows.Input;
namespace Elwig.Windows { namespace Elwig.Windows {
@ -42,7 +40,7 @@ namespace Elwig.Windows {
private TextBox[] PlzInputs; private TextBox[] PlzInputs;
private ComboBox[] ComboBoxInputs; private ComboBox[] ComboBoxInputs;
private ComboBox[] PlzOrtInputs; private ComboBox[] PlzOrtInputs;
private CheckComboBox[] CheckComboBoxInputs; private ListBox[] ListBoxInputs;
private CheckBox[] CheckBoxInputs; private CheckBox[] CheckBoxInputs;
private RadioButton[] RadioButtonInputs; private RadioButton[] RadioButtonInputs;
private readonly Dictionary<Control, bool> Valid; private readonly Dictionary<Control, bool> Valid;
@ -68,7 +66,7 @@ namespace Elwig.Windows {
TextBoxInputs = []; TextBoxInputs = [];
PlzInputs = []; PlzInputs = [];
ComboBoxInputs = []; ComboBoxInputs = [];
CheckComboBoxInputs = []; ListBoxInputs = [];
PlzOrtInputs = []; PlzOrtInputs = [];
CheckBoxInputs = []; CheckBoxInputs = [];
RadioButtonInputs = []; RadioButtonInputs = [];
@ -97,7 +95,7 @@ namespace Elwig.Windows {
TextBoxInputs = ControlUtils.FindAllChildren<TextBox>(this, ExemptInputs).ToArray(); TextBoxInputs = ControlUtils.FindAllChildren<TextBox>(this, ExemptInputs).ToArray();
ComboBoxInputs = ControlUtils.FindAllChildren<ComboBox>(this, ExemptInputs).ToArray(); ComboBoxInputs = ControlUtils.FindAllChildren<ComboBox>(this, ExemptInputs).ToArray();
CheckBoxInputs = ControlUtils.FindAllChildren<CheckBox>(this, ExemptInputs).ToArray(); CheckBoxInputs = ControlUtils.FindAllChildren<CheckBox>(this, ExemptInputs).ToArray();
CheckComboBoxInputs = ControlUtils.FindAllChildren<CheckComboBox>(this, ExemptInputs).ToArray(); ListBoxInputs = ControlUtils.FindAllChildren<ListBox>(this, ExemptInputs).ToArray();
RadioButtonInputs = ControlUtils.FindAllChildren<RadioButton>(this, ExemptInputs).ToArray(); RadioButtonInputs = ControlUtils.FindAllChildren<RadioButton>(this, ExemptInputs).ToArray();
PlzInputs = ControlUtils.FindAllChildren<TextBox>(this).Where(tb => "PLZ".Equals(tb.Tag)).ToArray(); PlzInputs = ControlUtils.FindAllChildren<TextBox>(this).Where(tb => "PLZ".Equals(tb.Tag)).ToArray();
PlzOrtInputs = PlzInputs.Select(tb => ControlUtils.FindNextSibling<ComboBox>(tb) ?? throw new MissingMemberException()).ToArray(); PlzOrtInputs = PlzInputs.Select(tb => ControlUtils.FindNextSibling<ComboBox>(tb) ?? throw new MissingMemberException()).ToArray();
@ -105,8 +103,8 @@ namespace Elwig.Windows {
Valid[tb] = true; Valid[tb] = true;
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
cb.SelectionChanged += ComboBox_SelectionChanged; cb.SelectionChanged += ComboBox_SelectionChanged;
foreach (var cb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
cb.ItemSelectionChanged += ComboBox_SelectionChanged; lb.SelectionChanged += ComboBox_SelectionChanged;
} }
private void OnClosing(object? sender, CancelEventArgs evt) { private void OnClosing(object? sender, CancelEventArgs evt) {
@ -151,8 +149,8 @@ namespace Elwig.Windows {
ControlUtils.ClearInputState(tb); ControlUtils.ClearInputState(tb);
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
ControlUtils.ClearInputState(cb); ControlUtils.ClearInputState(cb);
foreach (var ccb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
ControlUtils.ClearInputState(ccb); ControlUtils.ClearInputState(lb);
foreach (var cb in CheckBoxInputs) foreach (var cb in CheckBoxInputs)
ControlUtils.ClearInputState(cb); ControlUtils.ClearInputState(cb);
foreach (var rb in RadioButtonInputs) foreach (var rb in RadioButtonInputs)
@ -166,7 +164,7 @@ namespace Elwig.Windows {
Valid[input] = false; Valid[input] = false;
} else if (input is ComboBox cb && cb.SelectedItem == null && cb.ItemsSource != null) { } else if (input is ComboBox cb && cb.SelectedItem == null && cb.ItemsSource != null) {
ControlUtils.SetInputInvalid(input); ControlUtils.SetInputInvalid(input);
} else if (input is CheckComboBox ccb && ccb.SelectedItem == null && ccb.ItemsSource != null) { } else if (input is ListBox lb && lb.SelectedItem == null && lb.ItemsSource != null) {
ControlUtils.SetInputInvalid(input); ControlUtils.SetInputInvalid(input);
} else if (input is CheckBox ckb && ckb.IsChecked != true) { } else if (input is CheckBox ckb && ckb.IsChecked != true) {
ControlUtils.SetInputInvalid(input); ControlUtils.SetInputInvalid(input);
@ -190,8 +188,8 @@ namespace Elwig.Windows {
tb.IsReadOnly = true; tb.IsReadOnly = true;
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
cb.IsEnabled = false; cb.IsEnabled = false;
foreach (var ccb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
ccb.IsEnabled = false; lb.IsEnabled = false;
foreach (var cb in CheckBoxInputs) foreach (var cb in CheckBoxInputs)
cb.IsEnabled = false; cb.IsEnabled = false;
foreach (var rb in RadioButtonInputs) foreach (var rb in RadioButtonInputs)
@ -203,8 +201,8 @@ namespace Elwig.Windows {
tb.IsReadOnly = false; tb.IsReadOnly = false;
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
cb.IsEnabled = true; cb.IsEnabled = true;
foreach (var ccb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
ccb.IsEnabled = true; lb.IsEnabled = true;
foreach (var cb in CheckBoxInputs) foreach (var cb in CheckBoxInputs)
cb.IsEnabled = true; cb.IsEnabled = true;
foreach (var rb in RadioButtonInputs) foreach (var rb in RadioButtonInputs)
@ -224,8 +222,8 @@ namespace Elwig.Windows {
OriginalValues[tb] = ControlUtils.GetInputHashCode(tb); OriginalValues[tb] = ControlUtils.GetInputHashCode(tb);
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
OriginalValues[cb] = ControlUtils.GetInputHashCode(cb); OriginalValues[cb] = ControlUtils.GetInputHashCode(cb);
foreach (var ccb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
OriginalValues[ccb] = ControlUtils.GetInputHashCode(ccb); OriginalValues[lb] = ControlUtils.GetInputHashCode(lb);
foreach (var cb in CheckBoxInputs) foreach (var cb in CheckBoxInputs)
OriginalValues[cb] = ControlUtils.GetInputHashCode(cb); OriginalValues[cb] = ControlUtils.GetInputHashCode(cb);
foreach (var rb in RadioButtonInputs) foreach (var rb in RadioButtonInputs)
@ -277,8 +275,8 @@ namespace Elwig.Windows {
tb.Text = ""; tb.Text = "";
foreach (var cb in ComboBoxInputs) foreach (var cb in ComboBoxInputs)
cb.SelectedItem = null; cb.SelectedItem = null;
foreach (var ccb in CheckComboBoxInputs) foreach (var lb in ListBoxInputs)
ccb.SelectedItems.Clear(); lb.SelectedItems.Clear();
foreach (var cb in CheckBoxInputs) foreach (var cb in CheckBoxInputs)
cb.IsChecked = cb.IsThreeState ? null : false; cb.IsChecked = cb.IsThreeState ? null : false;
foreach (var rb in RadioButtonInputs) foreach (var rb in RadioButtonInputs)
@ -315,13 +313,13 @@ namespace Elwig.Windows {
!IsValid || !IsValid ||
TextBoxInputs.Any(InputHasChanged) || TextBoxInputs.Any(InputHasChanged) ||
ComboBoxInputs.Any(InputHasChanged) || ComboBoxInputs.Any(InputHasChanged) ||
CheckComboBoxInputs.Any(InputHasChanged) || ListBoxInputs.Any(InputHasChanged) ||
CheckBoxInputs.Any(InputHasChanged) || CheckBoxInputs.Any(InputHasChanged) ||
RadioButtonInputs.Any(InputHasChanged) RadioButtonInputs.Any(InputHasChanged)
) || IsCreating && ( ) || IsCreating && (
TextBoxInputs.Any(i => InputIsNotDefault(i) || (!i.IsReadOnly && i.Text != "")) || TextBoxInputs.Any(i => InputIsNotDefault(i) || (!i.IsReadOnly && i.Text != "")) ||
ComboBoxInputs.Any(i => InputIsNotDefault(i) || (i.IsEnabled && i.SelectedItem != null)) || ComboBoxInputs.Any(i => InputIsNotDefault(i) || (i.IsEnabled && i.SelectedItem != null)) ||
CheckComboBoxInputs.Any(i => InputIsNotDefault(i) || i.SelectedItem != null) || ListBoxInputs.Any(i => InputIsNotDefault(i) || i.SelectedItem != null) ||
CheckBoxInputs.Any(InputIsNotDefault) || CheckBoxInputs.Any(InputIsNotDefault) ||
RadioButtonInputs.Any(InputIsNotDefault) RadioButtonInputs.Any(InputIsNotDefault)
); );
@ -447,8 +445,8 @@ namespace Elwig.Windows {
bool valid = false; bool valid = false;
if (input is ComboBox cb) { if (input is ComboBox cb) {
valid = cb.ItemsSource == null || cb.SelectedItem != null || !RequiredInputs.Contains(input); valid = cb.ItemsSource == null || cb.SelectedItem != null || !RequiredInputs.Contains(input);
} else if (input is CheckComboBox ccb) { } else if (input is ListBox lb) {
valid = ccb.ItemsSource == null || ccb.SelectedItem != null || !RequiredInputs.Contains(input); valid = lb.ItemsSource == null || lb.SelectedItem != null || !RequiredInputs.Contains(input);
} }
if (valid) { if (valid) {
ValidateInput(input, true); ValidateInput(input, true);

View File

@ -6,7 +6,6 @@
xmlns:local="clr-namespace:Elwig.Windows" xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls" xmlns:ctrl="clr-namespace:Elwig.Controls"
mc:Ignorable="d" mc:Ignorable="d"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Flächenbindungen - Elwig" Height="500" MinHeight="440" Width="920" MinWidth="860" Title="Flächenbindungen - Elwig" Height="500" MinHeight="440" Width="920" MinWidth="860"
Loaded="Window_Loaded"> Loaded="Window_Loaded">
<Window.Resources> <Window.Resources>
@ -41,13 +40,6 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="VerticalAlignment" Value="Top"/>
</Style> </Style>
<Style TargetType="xctk:CheckComboBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/> <Setter Property="Padding" Value="9,3"/>

View File

@ -7,7 +7,6 @@ using Elwig.Models.Entities;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows { namespace Elwig.Windows {
public partial class AreaComAdminWindow : AdministrationWindow { public partial class AreaComAdminWindow : AdministrationWindow {
@ -431,7 +430,7 @@ namespace Elwig.Windows {
RefreshInputs(); RefreshInputs();
} }
private void AttributesInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) { private void AttributesInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
} }

View File

@ -19,6 +19,7 @@ namespace Elwig.Windows {
ClientAddressInput, ClientPlzInput, ClientOrtInput, ClientAddressInput, ClientPlzInput, ClientOrtInput,
]; ];
ExemptInputs = [ ExemptInputs = [
BranchList, AreaCommitmentTypeList, WineAttributeList, WineCultivationList, SeasonList, SeasonModifierList,
ClientNameFull, ClientNameFull,
BranchIdInput, BranchNameInput, BranchPlzInput, BranchOrtInput, BranchIdInput, BranchNameInput, BranchPlzInput, BranchOrtInput,
BranchAddressInput, BranchPhoneNrInput, BranchFaxNrInput, BranchMobileNrInput, BranchAddressInput, BranchPhoneNrInput, BranchFaxNrInput, BranchMobileNrInput,

View File

@ -6,7 +6,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows" xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls" xmlns:ctrl="clr-namespace:Elwig.Controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF" xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
mc:Ignorable="d" mc:Ignorable="d"
Title="Auszahlung - Elwig" Height="700" Width="1500" MinWidth="1000" MinHeight="500" Title="Auszahlung - Elwig" Height="700" Width="1500" MinWidth="1000" MinHeight="500"
@ -70,10 +69,10 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="Für:" Margin="10,-2,0,0" FontSize="14" Grid.Column="0" VerticalAlignment="Center"/> <Label Content="Für:" Margin="10,-2,0,0" FontSize="14" Grid.Column="0" VerticalAlignment="Center"/>
<xctk:CheckComboBox x:Name="VaributeInput" Margin="50,0,0,0" Grid.Column="0" Width="500" Height="25" HorizontalAlignment="Left" <ctrl:CheckComboBox x:Name="VaributeInput" Margin="50,0,0,0" Grid.Column="0" Width="500" Height="25" HorizontalAlignment="Left"
IsSelectAllActive="True" SelectAllContent="Alle Sorten" Delimiter=", " AllItemsSelectedContent="Alle Sorten" IsSelectAllActive="True" SelectAllContent="Alle Sorten" Delimiter=", " AllItemsSelectedContent="Alle Sorten"
IsEnabled="False" ItemSelectionChanged="VaributeInput_Changed"> IsEnabled="False" SelectionChanged="VaributeInput_Changed">
<xctk:CheckComboBox.ItemTemplate> <ctrl:CheckComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Variety.Name}" Width="150"/> <TextBlock Text="{Binding Variety.Name}" Width="150"/>
@ -84,8 +83,8 @@
<TextBlock Text="{Binding AssignedAbgewGraphId}" Width="30"/> <TextBlock Text="{Binding AssignedAbgewGraphId}" Width="30"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</xctk:CheckComboBox.ItemTemplate> </ctrl:CheckComboBox.ItemTemplate>
</xctk:CheckComboBox> </ctrl:CheckComboBox>
<CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False" Checked="AbgewertetInput_Changed" Unchecked="AbgewertetInput_Changed" <CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False" Checked="AbgewertetInput_Changed" Unchecked="AbgewertetInput_Changed"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Column="1"/> VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Column="1"/>

View File

@ -9,13 +9,9 @@ using Elwig.Controls;
using Elwig.Helpers; using Elwig.Helpers;
using Elwig.Helpers.Billing; using Elwig.Helpers.Billing;
using Elwig.Models.Entities; using Elwig.Models.Entities;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using ScottPlot.Plottables; using ScottPlot.Plottables;
using ScottPlot; using ScottPlot;
using Xceed.Wpf.Toolkit.Primitives;
using ScottPlot.Control; using ScottPlot.Control;
using System.Text.Json;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
namespace Elwig.Windows { namespace Elwig.Windows {
public partial class ChartWindow : ContextWindow { public partial class ChartWindow : ContextWindow {
@ -724,26 +720,31 @@ namespace Elwig.Windows {
} }
} }
private void VaributeInput_Changed(object sender, ItemSelectionChangedEventArgs e) { private void VaributeInput_Changed(object sender, SelectionChangedEventArgs evt) {
if (FillingInputs || e.Item is not Varibute v) return; if (FillingInputs) return;
var isOpen = VaributeInput.IsDropDownOpen; var isOpen = VaributeInput.IsDropDownOpen;
if (e.IsSelected) {
if (RemoveVaributeFromOthers(e.Item.ToString())) { foreach (var i in evt.AddedItems) {
if (i is not Varibute v) continue;
if (RemoveVaributeFromOthers(v.ToString())) {
if (AbgewertetInput.IsChecked == true) { if (AbgewertetInput.IsChecked == true) {
v.AssignedAbgewGraphId = SelectedGraphEntry?.Id; v.AssignedAbgewGraphId = SelectedGraphEntry?.Id;
} else { } else {
v.AssignedGraphId = SelectedGraphEntry?.Id; v.AssignedGraphId = SelectedGraphEntry?.Id;
} }
} else { } else {
VaributeInput.SelectedItems.Remove(e.Item); VaributeInput.SelectedItems.Remove(v);
} }
} else { }
foreach (var i in evt.RemovedItems) {
if (i is not Varibute v) continue;
if (AbgewertetInput.IsChecked == true) { if (AbgewertetInput.IsChecked == true) {
v.AssignedAbgewGraphId = null; v.AssignedAbgewGraphId = null;
} else { } else {
v.AssignedGraphId = null; v.AssignedGraphId = null;
} }
} }
SelectedGraphEntry!.Vaributes = VaributeInput.SelectedItems.Cast<Varibute>().ToList(); SelectedGraphEntry!.Vaributes = VaributeInput.SelectedItems.Cast<Varibute>().ToList();
SetHasChanged(); SetHasChanged();
GraphList.Items.Refresh(); GraphList.Items.Refresh();

View File

@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Elwig.Windows" xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls" xmlns:ctrl="clr-namespace:Elwig.Controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Lieferungen - Elwig" Height="720" Width="1100" MinHeight="720" MinWidth="1000" Title="Lieferungen - Elwig" Height="720" Width="1100" MinHeight="720" MinWidth="1000"
Loaded="Window_Loaded"> Loaded="Window_Loaded">
<Window.Resources> <Window.Resources>
@ -35,7 +34,7 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="VerticalAlignment" Value="Top"/>
</Style> </Style>
<Style TargetType="xctk:CheckComboBox"> <Style TargetType="ctrl:CheckComboBox">
<Setter Property="Height" Value="25"/> <Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
@ -474,9 +473,9 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="Zu-/Abschläge:" Margin="10,10,0,10"/> <Label Content="Zu-/Abschläge:" Margin="10,10,0,10"/>
<xctk:CheckComboBox x:Name="ModifiersInput" Margin="0,10,10,10" Grid.Column="1" Grid.ColumnSpan="2" <ctrl:CheckComboBox x:Name="ModifiersInput" Margin="0,10,10,10" Grid.Column="1" Grid.ColumnSpan="2"
ItemTemplate="{StaticResource ModifierTemplate}" Delimiter=", " AllItemsSelectedContent="Alle" ItemTemplate="{StaticResource ModifierTemplate}" Delimiter=", " AllItemsSelectedContent="Alle"
ItemSelectionChanged="ModifiersInput_SelectionChanged"/> SelectionChanged="ModifiersInput_SelectionChanged"/>
<Label Content="Anmerkung:" Margin="10,40,0,10"/> <Label Content="Anmerkung:" Margin="10,40,0,10"/>
<TextBox x:Name="PartCommentInput" Grid.Column="1" Margin="0,40,10,10" Grid.ColumnSpan="2" <TextBox x:Name="PartCommentInput" Grid.Column="1" Margin="0,40,10,10" Grid.ColumnSpan="2"

View File

@ -19,7 +19,6 @@ using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Threading; using System.Windows.Threading;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows { namespace Elwig.Windows {
public partial class DeliveryAdminWindow : AdministrationWindow { public partial class DeliveryAdminWindow : AdministrationWindow {
@ -2062,7 +2061,7 @@ namespace Elwig.Windows {
} }
private void ModifiersInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) { private void ModifiersInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
if (!IsEditing && !IsCreating) return; if (!IsEditing && !IsCreating) return;
var mod = ModifiersInput.SelectedItems.Cast<Modifier>(); var mod = ModifiersInput.SelectedItems.Cast<Modifier>();
var source = ModifiersInput.ItemsSource.Cast<Modifier>(); var source = ModifiersInput.ItemsSource.Cast<Modifier>();

View File

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows" xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:ctrl="clr-namespace:Elwig.Controls"
mc:Ignorable="d" mc:Ignorable="d"
MinWidth="650" MinHeight="400" Height="600" Width="950" MinWidth="650" MinHeight="400" Height="600" Width="950"
Closed="Window_Closed" Closed="Window_Closed"
@ -117,26 +117,26 @@
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/> Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,120,0,10"/> <Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,120,0,10"/>
<xctk:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name" <ctrl:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
Margin="50,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25" Margin="50,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/> SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,150,0,10"/> <Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,150,0,10"/>
<xctk:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name" <ctrl:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name"
IsSelectAllActive="True" SelectAllContent="Alle Stammgemeinden" IsSelectAllActive="True" SelectAllContent="Alle Stammgemeinden"
Margin="50,150,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25" Margin="50,150,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/> SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,180,0,10"/> <Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,180,0,10"/>
<xctk:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId" <ctrl:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId"
IsSelectAllActive="True" SelectAllContent="Alle Vertragsarten" IsSelectAllActive="True" SelectAllContent="Alle Vertragsarten"
Margin="50,180,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25" Margin="50,180,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/> SelectionChanged="MemberInput_SelectionChanged"/>
<xctk:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName" <ctrl:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName"
IsSelectAllActive="True" SelectAllContent="Alle Mitglieder" IsSelectAllActive="True" SelectAllContent="Alle Mitglieder"
Margin="10,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25" Margin="10,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/> SelectionChanged="MemberInput_SelectionChanged"/>
</Grid> </Grid>
</GroupBox> </GroupBox>

View File

@ -143,26 +143,26 @@ namespace Elwig.Windows {
.OrderBy(b => b.Name) .OrderBy(b => b.Name)
.ToListAsync(), MemberInput_SelectionChanged); .ToListAsync(), MemberInput_SelectionChanged);
if (MemberBranchInput.SelectedItems.Count == 0) { if (MemberBranchInput.SelectedItems.Count == 0) {
MemberBranchInput.ItemSelectionChanged -= MemberInput_SelectionChanged; MemberBranchInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberBranchInput.SelectAll(); MemberBranchInput.SelectAll();
MemberBranchInput.ItemSelectionChanged += MemberInput_SelectionChanged; MemberBranchInput.SelectionChanged += MemberInput_SelectionChanged;
} }
ControlUtils.RenewItemsSource(MemberKgInput, await ctx.Katastralgemeinden ControlUtils.RenewItemsSource(MemberKgInput, await ctx.Katastralgemeinden
.Where(k => k.WbKg!.Members.Any()) .Where(k => k.WbKg!.Members.Any())
.OrderBy(k => k.Name) .OrderBy(k => k.Name)
.ToListAsync(), MemberInput_SelectionChanged); .ToListAsync(), MemberInput_SelectionChanged);
if (MemberKgInput.SelectedItems.Count == 0) { if (MemberKgInput.SelectedItems.Count == 0) {
MemberKgInput.ItemSelectionChanged -= MemberInput_SelectionChanged; MemberKgInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberKgInput.SelectAll(); MemberKgInput.SelectAll();
MemberKgInput.ItemSelectionChanged += MemberInput_SelectionChanged; MemberKgInput.SelectionChanged += MemberInput_SelectionChanged;
} }
ControlUtils.RenewItemsSource(MemberAreaComInput, await ctx.AreaCommitmentTypes ControlUtils.RenewItemsSource(MemberAreaComInput, await ctx.AreaCommitmentTypes
.OrderBy(a => a.VtrgId) .OrderBy(a => a.VtrgId)
.ToListAsync(), MemberInput_SelectionChanged); .ToListAsync(), MemberInput_SelectionChanged);
if (MemberAreaComInput.SelectedItems.Count == 0) { if (MemberAreaComInput.SelectedItems.Count == 0) {
MemberAreaComInput.ItemSelectionChanged -= MemberInput_SelectionChanged; MemberAreaComInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberAreaComInput.SelectAll(); MemberAreaComInput.SelectAll();
MemberAreaComInput.ItemSelectionChanged += MemberInput_SelectionChanged; MemberAreaComInput.SelectionChanged += MemberInput_SelectionChanged;
} }
ControlUtils.RenewItemsSource(MemberCustomInput, await ctx.Members ControlUtils.RenewItemsSource(MemberCustomInput, await ctx.Members
.Where(m => m.IsActive) .Where(m => m.IsActive)
@ -178,9 +178,9 @@ namespace Elwig.Windows {
.Include(m => m.BillingAddress!.PostalDest.AtPlz!.Country) .Include(m => m.BillingAddress!.PostalDest.AtPlz!.Country)
.ToListAsync(), MemberInput_SelectionChanged); .ToListAsync(), MemberInput_SelectionChanged);
if (MemberCustomInput.SelectedItems.Count == 0) { if (MemberCustomInput.SelectedItems.Count == 0) {
MemberCustomInput.ItemSelectionChanged -= MemberInput_SelectionChanged; MemberCustomInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberCustomInput.SelectAll(); MemberCustomInput.SelectAll();
MemberCustomInput.ItemSelectionChanged += MemberInput_SelectionChanged; MemberCustomInput.SelectionChanged += MemberInput_SelectionChanged;
} }
await UpdateRecipients(ctx); await UpdateRecipients(ctx);
@ -296,7 +296,7 @@ namespace Elwig.Windows {
await UpdateRecipients(ctx); await UpdateRecipients(ctx);
} }
private async void MemberInput_SelectionChanged(object sender, RoutedEventArgs evt) { private async void MemberInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
using var ctx = new AppDbContext(); using var ctx = new AppDbContext();
await UpdateRecipients(ctx); await UpdateRecipients(ctx);
} }