I need to create a detailed view when a row in my DataGrid
Selected.
How should i get the headers of the datagrid and assign it to my detail view grid Label
.
and the Textblock near to label should contail the value of the header in the selected row.
Headers in my datagrid is not static. It might change in runtime. I have binded the itemsource of my datagrid with Ienumerable collection.
Thanks in advance if u could address my problem.
Update:
<my:DataGrid
Grid.Row="0"
x:Name="dataGrid1"
Width="auto"
AutoGenerateColumns="True" CanUserAddRows="True" Margin="0,0,0,0"
MouseRightButtonUp="dataGrid1_MouseRightButtonUp" />
In my code behind am binding Ienumerable collection.
this.dataGrid1.ItemsSource = objref.Result;
//Where objref.Result is Ienumerable collection
Then in my detailed view in XAML,
<Label>Date:</Label>
<TextBlockName="data"
Text="{Binding SelectedItem.date, ElementName=dataGrid1}" />
<Label>Username:</Label>
<TextBlock Name="username"
Text="{Binding SelectedItem.username, ElementName=dataGrid1}"
/>
Just hardcoding the column headers. It may change. How can i handle this.??