Question How do I update WPF ListBox with elements of selected XML file

Dion Alexander

New member
Joined
Oct 13, 2020
Messages
1
Programming Experience
Beginner
I have a WFP window that contains a ComboBox that is bound to a list of XML files and a ListBox that should display the elements of the selected XML file in the Combox. The TextBlock between the ComboBox and the ListBox is used to demonstrate that the binding to the selected value works. However, the ListBox displays the elements of the first XML file but does not update when the selection changes.

What have I done wrong and what am I missing?
 

Attachments

  • Query.zip
    5.3 KB · Views: 22
I have a WFP window that contains a ComboBox that is bound to a list of XML files and a ListBox that should display the elements of the selected XML file in the Combox. The TextBlock between the ComboBox and the ListBox is used to demonstrate that the binding to the selected value works. However, the ListBox displays the elements of the first XML file but does not update when the selection changes.

What have I done wrong and what am I missing?
Hi, I have not seen the Zip file but yours seems to be a binding error. Do you use the MVVM pattern? I suggest you to use. Have you implemented the INotifyPropertyChanged?
I think you have to:
  1. Implements the INotifyPropertyChanged (if you not alredy did)
  2. use an ObservableCollection binded to your ListBox and not a simple collection
Could you show some piece of code?
Hope this is useful.

Brendon
 
Have you tried debugging your code? You can find a debugger tutorial in my signature.

I am not downloading your zip file. So if you have a problem in your project, its best that you identify what that problem is and then post the relevant code here on the forums for us to review. All code must be posted within code tags [CODE=csharp] Your code here [/CODE].
 
Back
Top Bottom