I'm currently working on a WPF-Input Window and now I have following problem:
if (e.Key == System.Windows.Input.Key.Enter)
{
this.variantNumbers.Add(new VariantNumbers {Number =
txtVariantNo.Text});
lstBoxVariants.ItemsSource = this.variantNumbers;
lstBoxVariants.Visibility = Visibility.Visible;
txtVariantNo.Text = "";
}
When I click enter, I want to update the ItemsSource of the ListBox whilst I am setting the ItemsSource new every time I add an element.
What could be wrong here, that my ListBox ignores this setting, the first time I click Enter, it works, the second and following times it doesn't.
Please let me know if someone of you knows what could be wrong here.
Thank You!