Hi,
I am using Silverlight 3 to develop an application. In my app, I have a layout Grid (named "LayoutGrid") in which I have a DataGrid (named "PART_datagrid") with DataGridTemplateColumns. The LayoutGrid is set a DataContext in which there is a Ladders list as a property. This Ladders list is set as the ItemsSource for the PART_datagrid.
<Grid x:Name="LayoutRoot">
<DataGrid x:Name="PART_datagrid" ItemsSource="{Binding Ladders}">
...
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Name="DeleteLadder" Click.Command="{Binding ElementName=LayoutRoot, Path=DataContext.DeleteLadderCommand}" />
Now in one of the DataGridTemplateColumns I have a button which should invoke a Command thats present in the LayoutGrid's DataContext. So I tried Element-To-Element binding on my DataTemplate button as follows
<Button Name="DeleteLadder" Click.Command="{Binding ElementName=LayoutRoot, Path=DataContext.DeleteLadderCommand}" />
But this does not seem to work. What I want to achieve is to handle the event of deletion of a DataGrid row at the parent DataContext level using the command.
Can someone pls suggest how do I proceed on this?
Thanks in advance...