Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
370
Problem with GroupBy in ig:XamGrid
posted

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