I am using xamGrid in wpf project in which I need to group data based on one column. I have grid definition like this
<ig:XamGrid HorizontalAlignment="Stretch" Margin="5" Name="gvFields" VerticalAlignment="Stretch" AutoGenerateColumns="False" IsAlternateRowsEnabled="False" ItemsSource="{Binding ResultSet}"> <ig:XamGrid.GroupBySettings> <ig:GroupBySettings DisplayCountOnGroupedRow="False" IsGroupByAreaExpanded="True" ></ig:GroupBySettings> </ig:XamGrid.GroupBySettings> <ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellClickAction="SelectRow" ColumnSelection="Single"></ig:SelectionSettings> </ig:XamGrid.SelectionSettings> <ig:XamGrid.Columns> <ig:TextColumn HeaderText="Company Name" Key="CompanyName" Width="220" IsReadOnly="True"></ig:TextColumn> <ig:TextColumn HeaderText="Ticker" Key="Ticker" Width="90" IsReadOnly="True"></ig:TextColumn> <ig:TextColumn HeaderText="MicCode" Key="MicCode" Width="90" IsReadOnly="True"></ig:TextColumn> <ig:TextColumn HeaderText="Publisher" Key="AuthorOrganization" Width="140" IsReadOnly="True"></ig:TextColumn> <ig:TextColumn HeaderText="ClusterNo" Key="ClusterNo" IsGroupBy="True" Width="120" IsReadOnly="True"></ig:TextColumn> <ig:TextColumn HeaderText="Industry" Key="Industry" Width="250" IsReadOnly="True"></ig:TextColumn> </ig:XamGrid.Columns> </ig:XamGrid>
i.e. it group by "ClusterNo". In my ViewModel, I have property
public DataTable ResultSet { get { return processor.ResultSet; } }
when user fire "Run" command, it process data and then fire
OnPropertyChanged("ResultSet");
and so databound properly which will also grouped by ClusterNo as required. But when user again press Run command, we process data in viewmodel and then fire this "OnPropertyChanged"......after this data display in Grid but Grouping has been removed. (Note, on each Run, data content may change but number of columns will remain same).
Why it is removing Grouping on next re-bind? Is there any way to make group fixed?Also I want to hide grouped column (i.e. ClusterNo) from Grid columns and it only visible as Grouping......
Please help.
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hello Stefan,
Yes it works. Thank you for your support.