views:

146

answers:

1

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?

A: 

What you need to do is to define in the xaml that your list items are TextBox. You can read a similar problem here: http://stackoverflow.com/questions/632713/textbox-button-and-listbox-in-a-listbox

jpsstavares
I don't want the list items to always be (or appear to be) a TextBox. I just want them to be editable like a TextBox, triggered by user interaction.
luke
I think I get it. Something like a double click and it turns to a TextBox.I believe this is exactly what you are looking for: http://msdn.microsoft.com/en-us/library/ms771277.aspx
jpsstavares
The link in your comment is what I'm looking for. Thank you.
luke