From 55e3e4cc93b4eceeb4e68b7364fc8d6a3f0ea14a Mon Sep 17 00:00:00 2001 From: wnj00524 <68168066+wnj00524@users.noreply.github.com> Date: Tue, 7 Apr 2026 21:52:02 +0100 Subject: [PATCH] Preserve node editor traffic type selection --- src/MedWNetworkSim.App/ViewModels/MainWindowViewModel.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MedWNetworkSim.App/ViewModels/MainWindowViewModel.cs b/src/MedWNetworkSim.App/ViewModels/MainWindowViewModel.cs index 0384d51..f27a5f9 100644 --- a/src/MedWNetworkSim.App/ViewModels/MainWindowViewModel.cs +++ b/src/MedWNetworkSim.App/ViewModels/MainWindowViewModel.cs @@ -886,6 +886,7 @@ private void RefreshNodeIdOptions() private void RefreshTrafficTypeNameOptions() { + var selectedTrafficType = SelectedNodeTrafficProfile?.TrafficType; var trafficTypeNames = TrafficDefinitions .Select(definition => definition.Name) .Concat(Nodes.SelectMany(node => node.TrafficProfiles).Select(profile => profile.TrafficType)) @@ -894,6 +895,12 @@ private void RefreshTrafficTypeNameOptions() .OrderBy(name => name, Comparer); SynchronizeCollection(TrafficTypeNameOptions, trafficTypeNames); + + // Re-announce the current selection after rebuilding the options collection so WPF restores the combo value. + if (!string.IsNullOrWhiteSpace(selectedTrafficType)) + { + OnPropertyChanged(nameof(SelectedNodeTrafficType)); + } } private void RefreshEdgeBindings()