Hi,
I am trying to retrieve data from a Gridview that I have created in XAML.
<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="ID" DisplayMemberBinding="{Binding ID}" Width="100"/>
</GridView>
</ListView.View>
</ListView>
I have seen some code like this :-
GridViewRow row = GridView1.SelectedRow;
TextBox2.Text = row.Cells[2].Text;
However my problem is that my GridView is created in XAML, and is not named, ie I cannot (or do not know how to) create a reference to 'gridview1', and therefore cannot access objects within it.
Can I name or create a reference to my gridview either from c# or XAML so I can use the above code?
Secondly, can I then access the array elements by name instead of index, something like :-
TextBox2.Text = row.Cells["ID"].Text
Thanks for any help.