Fix delivery part selection in DeliveryAdminWindow

This commit is contained in:
2023-07-18 17:39:59 +02:00
parent 8c0df674ec
commit 9584f12fc5
3 changed files with 3 additions and 1 deletions

View File

@ -173,7 +173,7 @@ namespace Elwig.Windows {
DateInput.Text = d.Date.ToString("dd.MM.yyyy"); DateInput.Text = d.Date.ToString("dd.MM.yyyy");
TimeInput.Text = d.Time?.ToString("HH:mm") ?? ""; TimeInput.Text = d.Time?.ToString("HH:mm") ?? "";
CommentInput.Text = d.Comment ?? ""; CommentInput.Text = d.Comment ?? "";
Utils.RenewItemsSource(DeliveryPartList, d.Parts, i => ((i as DeliveryPart)?.Year, (i as DeliveryPart)?.DId)); Utils.RenewItemsSource(DeliveryPartList, d.Parts, i => ((i as DeliveryPart)?.Year, (i as DeliveryPart)?.DId, (i as DeliveryPart)?.DPNr));
if (DeliveryPartList.SelectedItem == null && DeliveryPartList.ItemsSource != null) { if (DeliveryPartList.SelectedItem == null && DeliveryPartList.ItemsSource != null) {
DeliveryPartList.SelectedIndex = 0; DeliveryPartList.SelectedIndex = 0;
} }

View File

@ -12,5 +12,6 @@
SelectedItemsOverride="{Binding SelectedItems}" SelectedItemsOverride="{Binding SelectedItems}"
ItemSelectionChanged="OnItemSelectionChanged"/> ItemSelectionChanged="OnItemSelectionChanged"/>
<TextBlock x:Name="MyText" HorizontalAlignment="Left" Margin="318,246,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/> <TextBlock x:Name="MyText" HorizontalAlignment="Left" Margin="318,246,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<ListBox x:Name="MyListBox" HorizontalAlignment="Left" Margin="492,125,0,0" VerticalAlignment="Top"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -7,6 +7,7 @@ namespace Elwig.Windows {
public TestWindow() { public TestWindow() {
InitializeComponent(); InitializeComponent();
MyComboBox.ItemsSource = new string[] { "Klasse A" , "Klasse B", "Klasse C", "Klasse D", "Klasse E", "Klasse F" }; MyComboBox.ItemsSource = new string[] { "Klasse A" , "Klasse B", "Klasse C", "Klasse D", "Klasse E", "Klasse F" };
MyListBox.ItemsSource = new string[] { "Test 1", "Test 2", "Test 3", "Test 4" };
} }
private void OnItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) { private void OnItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) {