Hi,
i've a problem with the ig:XamGrid.I use a ViewModel with a Collection and a ICollectionView like this.
private ObservableCollection<ComplexObject> _liste = new ObservableCollection<ComplexObject>();private CollectionViewSource _viewsource = new CollectionViewSource();
public CTOR(){this._viewsource .Source = this._liste ;//this._viewsource .GroupDescriptions.Add(new PropertyGroupDescription("Antragsstatus"));//this._viewsource .SortDescriptions.Add(new SortDescription("Antragsstatus", ListSortDirection.Ascending));}
public ICollectionView Liste { get { return this._viewsource .View; } }
The View is like this.
<ig:XamGrid Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding Liste}" > <ig:XamGrid.Resources> <Style TargetType="{x:Type ig:CellControl}"> <EventSetter Event="MouseDoubleClick" Handler="Antragsliste_PreviewMouseDoubleClick" /> <!--<EventSetter Event="KeyDown" Handler="listboxErläuterungstexteListViewItem_KeyDown" />--> </Style> </ig:XamGrid.Resources>
<ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellClickAction="SelectRow" CellSelection="Single" ColumnSelection="Single" RowSelection="Single" /> </ig:XamGrid.SelectionSettings>
<ig:XamGrid.PagerSettings> <ig:PagerSettings AllowPaging="Both" PageSize="20" /> </ig:XamGrid.PagerSettings>
<ig:XamGrid.ColumnMovingSettings> <ig:ColumnMovingSettings AllowColumnMoving="Indicator"/> </ig:XamGrid.ColumnMovingSettings>
<ig:XamGrid.GroupBySettings> <ig:GroupBySettings AllowGroupByArea="Top" DisplayCountOnGroupedRow="True" /> </ig:XamGrid.GroupBySettings>
<ig:XamGrid.SortingSettings> <ig:SortingSettings AllowSorting="True" AllowMultipleColumnSorting="True" ShowSortIndicator="True"/> </ig:XamGrid.SortingSettings>
<ig:XamGrid.Columns> <ig:TemplateColumn Key="Antragsstatus" IsGroupBy="True" IsSorted="Ascending" Width="5"> <ig:TemplateColumn.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="24"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Height="16" Width="16" Source="{Binding Path=Antragsstatus, Converter={StaticResource antragstatusconverter}}" /> <TextBlock Grid.Column="1" Text="{Binding Path=Antragsstatus, Converter={StaticResource antragstatustotextconverter}}" FontWeight="Bold" Margin="5,0,0,0" /> </Grid> </DataTemplate> </ig:TemplateColumn.ItemTemplate> <ig:TemplateColumn.GroupByItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="24"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Height="16" Width="16" Source="{Binding Path=Value, Converter={StaticResource antragstatusconverter}}" /> <TextBlock Grid.Column="1" Text="{Binding Path=Value, Converter={StaticResource antragstatustotextconverter}}" FontWeight="Bold" Margin="5,0,0,0" /> </Grid> </DataTemplate> </ig:TemplateColumn.GroupByItemTemplate>
</ig:TemplateColumn>
<ig:TextColumn Key="Antragsdatum" FormatString="{}{0:d}" IsSorted="Descending" /> <ig:TextColumn Key="Eingangsdatum" FormatString="{}{0:d}" IsSorted="Descending" /> <ig:TextColumn Key="FaelligkeitsDatum" FormatString="{}{0:d}" IsSorted="Ascending" />
<!--<ig:TemplateColumn Key="TemplateColumn2" HorizontalContentAlignment="Center"> <ig:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock> <TextBlock.Text> <MultiBinding Converter="{StaticResource antragfaelligkeitsconverter}" Mode="OneWay"> <Binding Path="FaelligkeitsDatum" /> <Binding Path="Antragsstatus" /> </MultiBinding> </TextBlock.Text> </TextBlock> </DataTemplate> </ig:TemplateColumn.ItemTemplate> </ig:TemplateColumn>-->
<ig:TextColumn Key="AbschlagEinbehalte" FormatString="{}{0:C}" /> <ig:TextColumn Key="SummeEigenbehalte" FormatString="{}{0:C}" /> <ig:TextColumn Key="AuszuzahlenderBetrag" FormatString="{}{0:C}" /> </ig:XamGrid.Columns> </ig:XamGrid>
The Problem is, that everytime, i open this view an the collection is refreshed, the groupheader disapears like this.
When i remove the group by and reasign the group by, the it is correct.
thanks,
Markus
Hi Markus,
I've tested the code you provided in a sample and was unable to reproduce the issue described. Upon startup the grid is grouped by the 'Antragsstatus' column and when I refresh the CollectionView the data remains grouped.
Please see attached to this post the sample I used to test. If you feel the sample does not accurately demonstrate what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Do you still require assistance on this issue?