I added a button in Xamdatagrid headerprefix area.
<Style TargetType="{x:Type igDP:HeaderPrefixArea}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:HeaderPrefixArea}"> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Width="10" Height="10" Content="{Binding DataPresenter.DataContext.ExpandCollapse}" Command="{Binding DataPresenter.DataContext.ExpandCollapseCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=igDP:XamDataGrid}}"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
and inside command i have written code to exapnd all records.
private void ExapndCollapse(object obj) { XamDataGrid grid = obj as XamDataGrid; if (isExpand) { foreach (var record in grid.Records) { record.IsExpanded = true; }
isExpand = false; } else { foreach (var record in grid.Records) { record.IsExpanded = false; }
isExpand = true; } }
But now after expanding each row again i am getting this expand collapse button in sub header prefix areas. even when i click child header sections command is getting fired and all collapsed.
Can you please provide any suggestion.
Hello YUG,
Thank you for posting in our forums!
I recommend checking out this forum response from Stefan where he provided a nice solution to what you are trying to accomplish.
https://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/83828/ability-to-expand-all-collapse-all-in-xamdatagrid-with-expansion-indicator---in-the-header/437636#437636
If you need further assistance, please let me know.