So I have a custom control:
<Grid>
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
<CheckBox x:Name="chkboxListen" HorizontalAlignment="Center" Checked="chkboxListen_Checked" Unchecked="chkboxListen_Unchecked"/>
<MediaElement x:Name="mediaElementAudioPlayer" Volume="{Binding ElementName=sliderVol, Path=Value}" />
</StackPanel>
</Grid>
And it will reside within a DataGrid Template Column:
<DataGridTemplateColumn x:Name="callListenL" Header="Listen(L)" IsReadOnly="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<localControls:AudioPlay x:Name="audioPlayL" localControls:AudioPlay>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
My question is:
When I Check the chkboxListen CheckBox, how I can get the Information from the row of the DataGrid (Parent)? Each row has a myObject with an Id. I just need that Id.
Thank you in advance.
You can expose a property from within your user control and set the value of that property when the datagrid data binds.
For example, say your user control’s property is called ParentRowId you could set it in code behind or use an Eval expression