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.
How do I code the UpdateButton_Click so that the source gets updated from the Listbox? Any help much appreciated.
Key components of my xml coding are:
<StackPanel.Resources><XmlDataProviderx:Key="xmlFeed"Source="c:\users\brian\desktop\testxml.xml"XPath="Greens/item"/></StackPanel.Resources> ... <ListBoxName="entryListBox"Height="300"Width="200"ItemsSource="{Binding Source={StaticResource xmlFeed}, XPath=//Greens/item}"IsSynchronizedWithCurrentItem="True"Visibility="Visible"SelectionMode="Single"><ListBox.ItemTemplate><DataTemplate><TextBlockText="{Binding XPath=title}"/></DataTemplate></ListBox.ItemTemplate></ListBox>
<TextBlockGrid.Row="0"Grid.Column="0">Title</TextBlock><TextBoxGrid.Row="0"Grid.Column="1"Name="titleText"Text="{Binding XPath=title}"/><TextBlockGrid.Row="1"Grid.Column="0">URL</TextBlock><TextBoxGrid.Row="1"Grid.Column="1"Name="urlText"Text="{Binding XPath=guid}"/><TextBlockGrid.Row="2"Grid.Column="0">Date</TextBlock><TextBoxGrid.Row="2"Grid.Column="1"Name="dateText"Text="{Binding XPath=pubDate}"/><TextBlockGrid.Row="3"Grid.Column="0">Body</TextBlock><TextBoxGrid.Row="3"Grid.Column="1"Name="bodyText"TextWrapping="Wrap"Text="{Binding XPath=description}"/><ButtonGrid.Row="4"Grid.ColumnSpan="2"Grid.Column="0"Click="updateButton_Click"> Update</Button>
<o:p></o:p>