Hi
I'm raw when it comes to using WPF and c# so forgive me if I'm asking a basic question.<o:p></o:p>
I have a Stackpanel with a Listbox and a set of Textblocks which are bound together. The Listbox gets its values from an xml file. The bindings work great. My problem is I want the result of changing the Listbox to be saved back to the source xml file and I'm unsure how to do this. I've hunted high and low and can't find anything to guide me.
I've a button that I want to use to update the source file testxml.xml but I'm unable to code the click event to perform the update. Can anyone help please?
Key components of my xml coding are:
<StackPanel.Resources><XmlDataProvider x:Key="xmlFeed" Source="c:\users\brian\desktop\testxml.xml" XPath="Greens/item"/></StackPanel.Resources>
...
<ListBox Name="entryListBox"
Height="300"
Width="200"
ItemsSource="{Binding Source={StaticResource xmlFeed}, XPath=//Greens/item}"
IsSynchronizedWithCurrentItem="True"
Visibility="Visible"
SelectionMode="Single"><ListBox.ItemTemplate><DataTemplate><TextBlock Text="{Binding XPath=title}" /></DataTemplate></ListBox.ItemTemplate></ListBox><TextBlock Grid.Row="0" Grid.Column="0">Title</TextBlock><TextBox Grid.Row="0" Grid.Column="1" Name="titleText"
Text="{Binding XPath=title}"/><TextBlock Grid.Row="1" Grid.Column="0">URL</TextBlock><TextBox Grid.Row="1" Grid.Column="1" Name="urlText"
Text="{Binding XPath=guid}"/><TextBlock Grid.Row="2" Grid.Column="0">Date</TextBlock><TextBox Grid.Row="2" Grid.Column="1" Name="dateText"
Text="{Binding XPath=pubDate}"/><TextBlock Grid.Row="3" Grid.Column="0">Body</TextBlock><TextBox Grid.Row="3" Grid.Column="1"
Name="bodyText"
TextWrapping="Wrap"
Text="{Binding XPath=description}"
/><Button Grid.Row="4"
Grid.ColumnSpan="2"
Grid.Column="0"
Click="updateButton_Click">
Update</Button><o:p></o:p>