|
@@ -1,4 +1,5 @@
|
|
-using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
+using System.Windows;
|
|
|
|
+using Microsoft.Extensions.DependencyInjection;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using UniformMaterialManagementSystem.ViewModels;
|
|
using UniformMaterialManagementSystem.ViewModels;
|
|
|
|
|
|
@@ -79,5 +80,15 @@ namespace UniformMaterialManagementSystem.Views
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void Name_OnLostFocus(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ if (sender is not ComboBox comboBox) return;
|
|
|
|
+ var text = comboBox.Text;
|
|
|
|
+
|
|
|
|
+ if (string.IsNullOrWhiteSpace(text) || comboBox.Items.Contains(text) || comboBox.ItemsSource is not List<string> names) return;
|
|
|
|
+
|
|
|
|
+ names.Add(text);
|
|
|
|
+ comboBox.SelectedItem = text;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|