Click here to Skip to main content
15,886,963 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF: Combobox in TreeviewItem Pin
Insincere Dave25-Mar-09 6:45
Insincere Dave25-Mar-09 6:45 
GeneralRe: WPF: Combobox in TreeviewItem Pin
levik200625-Mar-09 7:10
levik200625-Mar-09 7:10 
QuestionTrackball.cs problem Pin
grJubei25-Mar-09 5:57
grJubei25-Mar-09 5:57 
QuestionMusic Player in WPF.. Pin
VisualLive25-Mar-09 0:06
VisualLive25-Mar-09 0:06 
AnswerRe: Music Player in WPF.. Pin
BlitzPackage27-Mar-09 15:37
BlitzPackage27-Mar-09 15:37 
QuestionTreeview Pin
Ch.Gayatri Subudhi24-Mar-09 18:04
Ch.Gayatri Subudhi24-Mar-09 18:04 
AnswerRe: Treeview Pin
Mark Salsbery25-Mar-09 6:56
Mark Salsbery25-Mar-09 6:56 
QuestionEditing items in a bound ListBox? Pin
David Veeneman24-Mar-09 12:25
David Veeneman24-Mar-09 12:25 
How do I go about editing items in a bound ListBox? I thought it would be as simple as binding a TextBox to the ListBox, but apparently, it's not.

I am creating a WPF window that displays a list of color names in a ListBox. The list comes from a property on the DataContext, to which the ListBox.ItemsSource property is bound. When I select a ListBox item, I want it to appear in a TextBox. Any changes I make in the TextBox should update the selected ListBox item.

Here's my XAML for the ListBox:

<ListBox 
     x:Name="ListBoxColors" 
     ItemsSource="{Binding ColorNames}" />


And here's my XAML for the TextBox, whose Text property is bound to the ListBox:

<TextBox 
     Text="{Binding ElementName=ListBoxColors, 
     Path=SelectedValue.Content, Mode=TwoWay, 
     UpdateSourceTrigger=PropertyChanged}" />


The ListBox binding works fine in both directions, but the TextBox binding only works in one direction--from the ListBox to the TextBox. Canges in the TextBox are not propagated back to the ListBox.

Here's my question: Can a TextBox Be bound to a bound ListBox in XAML, or do I have to go back to handling events in code-behind. If it can be done with XAML bindings, how? Thanks for your help.

David Veeneman
www.veeneman.com

AnswerRe: Editing items in a bound ListBox? Pin
ABitSmart24-Mar-09 19:00
ABitSmart24-Mar-09 19:00 
GeneralRe: Editing items in a bound ListBox? Pin
David Veeneman25-Mar-09 3:04
David Veeneman25-Mar-09 3:04 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart25-Mar-09 3:53
ABitSmart25-Mar-09 3:53 
AnswerRe: Editing items in a bound ListBox? [modified] Pin
David Veeneman25-Mar-09 3:50
David Veeneman25-Mar-09 3:50 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart25-Mar-09 4:02
ABitSmart25-Mar-09 4:02 
GeneralRe: Editing items in a bound ListBox? Pin
David Veeneman25-Mar-09 5:29
David Veeneman25-Mar-09 5:29 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart25-Mar-09 5:40
ABitSmart25-Mar-09 5:40 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 20:50
Member 367392230-Jun-09 20:50 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart30-Jun-09 20:56
ABitSmart30-Jun-09 20:56 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 21:00
Member 367392230-Jun-09 21:00 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart30-Jun-09 21:21
ABitSmart30-Jun-09 21:21 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 21:34
Member 367392230-Jun-09 21:34 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart30-Jun-09 21:37
ABitSmart30-Jun-09 21:37 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 22:45
Member 367392230-Jun-09 22:45 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 21:05
Member 367392230-Jun-09 21:05 
GeneralRe: Editing items in a bound ListBox? Pin
ABitSmart30-Jun-09 21:35
ABitSmart30-Jun-09 21:35 
GeneralRe: Editing items in a bound ListBox? Pin
Member 367392230-Jun-09 20:56
Member 367392230-Jun-09 20:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.