I have a grid that I have enabled group by on and in the group by header i've added an "Email All"
button and when I click that button I would like to get access to only the records in that group and perform some operation on them. Is that possible? If so, what is the best way to accomplish this?
Thanks!
-MajorK
Stephen Zaharuk said: Hi, You can just pass in the DataContext of the DataTemplate to the Tag of the button and access the specific records in your eventHandler, like so: Hope this helps, -SteveZ
Hi,
You can just pass in the DataContext of the DataTemplate to the Tag of the button and access the specific records in your eventHandler, like so:
Hope this helps,
-SteveZ
Nice moves Captain Z! I can see why you make the big bucks.
Thanks again.
<ig:TextColumn Key="Type">
<ig:TextColumn.GroupByItemTemplate>
<DataTemplate>
<Button Content="Email" Click="Button_Click_1" Tag="{Binding}"/>
</DataTemplate>
</ig:TextColumn.GroupByItemTemplate>
</ig:TextColumn>
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Button b = ((Button)sender);
GroupByDataContext gbdc = b.Tag as GroupByDataContext;
if (gbdc != null)
foreach (object data in gbdc.Records)
// e-mail them.
}
Just to clarify, if I click on the "Nav Tech" row, I want to loop through the 18 records in that grouping.