Hello,
Given a sample code below how do I make a group row selectable (at least visual).
I can select any child row but I cannot select a group row. When all rows collapsed I cannot identify which row is selected.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igDP="http://infragistics.com/DataPresenter" x:Class="WpfApplication1.MainWindow" Title="MainWindow" Height="350" Width="525"> <Grid> <igDP:XamDataGrid BindToSampleData="True"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings HeaderPlacementInGroupBy="OnTopOnly" GroupBySummaryDisplayMode="SummaryCellsAlwaysBelowDescription"/> </igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False" CellClickAction="SelectRecord" AllowSummaries="False" SummaryUIType="MultiSelect" SummaryDisplayArea="InGroupByRecords"/> </igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout>
<igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription FieldName="department" Direction="Ascending" IsGroupBy="True"/> </igDP:FieldLayout.SortedFields>
<igDP:FieldLayout.SummaryDefinitions> <igDP:SummaryDefinition Calculator="{x:Static igDP:SummaryCalculator.Sum}" SourceFieldName="salary" StringFormat="{}{0:#,###.00;(#,###.00);0}"> </igDP:SummaryDefinition> </igDP:FieldLayout.SummaryDefinitions>
</igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid> </Grid></Window>
Hi Andrew,
Perfect. That's what I need.
Thanks
Max
Hello Max,
When a XamDataGrid is grouped, the resultant GroupByRecords actually do have an IsSelected property, which gets activated or deactivated when one of these records is clicked. It appears that there is not currently a Style for this selected state, though, which may have been an oversight by our development team in this case.
If you would like to have a visual cue that a GroupByRecord has been selected, I would recommend that you include the default style for GroupByRecordPresenter and add a DataTrigger to its ControlTemplate.Triggers collection. If you have this trigger bind to the IsSelected property of the underlying data context GroupByRecord and check for true, you can add a Setter targeting a Border element named "highlight" and set its Background color. The default style for GroupByRecordPresenter can commonly be found in the DataPresenterGeneric_Express.xaml file at the following directory:
C:\Program Files (x86)\Infragistics\your_version_here\WPF\DefaultStyles\DataPresenter
I have attached a sample project to demonstrate the above. I hope this helps.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer