c# - Single line when binding XmlDataProvider to ListView -
I want to show XmlData within a ListView XmlDataProvider is filled correctly but the list view only shows the first line of XmlDocument What do I have to do to show all the rows inside?
& lt; window. Resources & gt; & Lt; XmlDataProvider x: key = "xmlData" /> & Lt; /Window.Resources> & Lt; DockPanel & gt; & Lt; ListView Padding = "4" & gt; & Lt; ListView.ItemsSource & gt; & Lt; Binding source = "{StaticResource xmlData}" XPath = "*" /> & Lt; /ListView.ItemsSource> & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Header = "Info" width = "256" DisplayMemberBinding = "{Binding XPath = Message}" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; / DockPanel & gt; In the back code:
Private void RefreshList (XmlDocument document) {XmlDataProvider Provider = (XmlDataProvider) FindResource ("xmlData"); the provider. Document = doctor; Provider.Refresh (); }
OK so I resolved it like this:
- Add XPath to XmlDataProvider
- Use the path = Internate instead of XPath
See the source below.
& lt; Window Resource & gt; & Lt; XmlDataProvider x: key = "xmlData" XPath = "// prototype" /> & Lt; /Window.Resources> & Lt; DockPanel & gt; & Lt; ListView & gt; & Lt; ListView.ItemsSource & gt; & Lt; Binding Source = "{StaticResource xmlData}" XPath = "Message" /> & Lt; /ListView.ItemsSource> & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Width = "Auto" DisplayMemberBinding = "{Binding Path = Internate}" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; / DockPanel & gt;
Comments
Post a Comment