Hi,
I have a GridView defined like this :-
< ListView Name="chartListView" SelectionChanged="chartListView_SelectionChanged">
< ListView.View>
< GridView>
< GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="250"/>
< GridViewColumn Header="Type" DisplayMemberBinding="{Binding Type}" Width="60"/>
< GridViewColumn Header="Default Font" DisplayMemberBinding="{Binding defaultFontName}" Width="100"/>
< GridViewColumn Header="Size" DisplayMemberBinding="{Binding defaultFontSize}" Width="40"/>
< GridViewColumn Header="ID" DisplayMemberBinding="{Binding ID}" Width="100"/>
</GridView>
</ListView.View>
</ListView>
and I populate the GridView with an XML datasource like this
XDocument xml = XDocument.Load(@"D:\devel\VS\pchart\charts.xml");
var query = from p in xml.Elements("charts").Elements("chart")
select p;
foreach (var record in query)
{
chartListView.Items.Add(new { Name = record.Attribute("Name").Value, Type = record.Attribute("Type").Value, defaultFontName = record.Attribute("defaultFontName").Value, defaultFontSize = record.Attribute("defaultFontSize").Value, ID = record.Attribute("ID").Value });
}
My question is, when a user clicks on a row in the GridView, and the function chartListView_SelectionChanged is triggered, how do select the corresponding record in my XML datasource, so that I can manipulate the correct/selected data?
Thanks, Will.