Reputation: 37493
I've got a plain-old WPF ListBox defined in my .xaml:
...
<ListBox Name="foo">
</ListBox>
...
In my matching .xaml.cs I programmatically add strings to this ListBox.
I'd like to be able to edit these strings from the UI at runtime.
I'm new to WPF, so my first thought was to dynamically replace the string in the ListBox's collection with a TextBox via a callback. Though this produced no error, it didn't appear to change the UI at all.
Is there a standard approach to doing this sort of thing in WPF?
Upvotes: 5
Views: 19879
Reputation: 3383
What you need to do is to define in the xaml that your list items are TextBox. You can read a similar problem here: TextBox, Button and ListBox in a ListBox
Upvotes: 5