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?
Hi Rob,
sorry for my late reply.
I've tested your greate example, and i think i've found the root cause.I've modified your example, so that the data where loaded, when you push the refresh button.And you can see, that the grouping is wrong.
public class MainWindowViewModel { private ObservableCollection<ComplexObject> _liste = new ObservableCollection<ComplexObject>(); private CollectionViewSource _viewsource = new CollectionViewSource(); public MainWindowViewModel() { 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; } }
public void Refresh() { _liste.Add(new ComplexObject() { AbschlagEinbehalte = 0.00M, Antragsdatum = new DateTime(2009, 3, 23), Antragsstatus = "Antrag aus Datenubernahme", AuszuzahlenderBetrag = 0.00M, Eingangsdatum = new DateTime(2009, 3, 31), FaelligkeitsDatum = new DateTime(2009, 4, 10), SummeEigenbehalte = 0.00M, }); _liste.Add(new ComplexObject() { AbschlagEinbehalte = 129.65M, Antragsdatum = new DateTime(2011, 6, 20), Antragsstatus = "Antrag aus Datenubernahme", AuszuzahlenderBetrag = 129.65M, Eingangsdatum = new DateTime(2011, 7, 7), FaelligkeitsDatum = new DateTime(2011, 7, 17), SummeEigenbehalte = 0.00M, }); _liste.Add(new ComplexObject() { AbschlagEinbehalte = 0.00M, Antragsdatum = new DateTime(2010, 3, 14), Antragsstatus = "Antrag zum Druck", AuszuzahlenderBetrag = 219.00M, Eingangsdatum = new DateTime(2012, 3, 15), FaelligkeitsDatum = new DateTime(2012, 3, 25), SummeEigenbehalte = 180.00M, }); _liste.Add(new ComplexObject() { AbschlagEinbehalte = 117.35M, Antragsdatum = new DateTime(2009, 10, 7), Antragsstatus = "Antrag aus Datenubernahme", AuszuzahlenderBetrag = 117.35M, Eingangsdatum = new DateTime(2009, 10, 9), FaelligkeitsDatum = new DateTime(2009, 10, 19), SummeEigenbehalte = 0.00M, }); _liste.Add(new ComplexObject() { AbschlagEinbehalte = 0.00M, Antragsdatum = new DateTime(2012, 3, 15), Antragsstatus = "Antrag in Bearbeitung", AuszuzahlenderBetrag = 353.11M, Eingangsdatum = new DateTime(2012, 3, 16), FaelligkeitsDatum = new DateTime(2009, 3, 26), SummeEigenbehalte = 0.00M, }); _liste.Add(new ComplexObject() { AbschlagEinbehalte = 0.00M, Antragsdatum = new DateTime(2010, 9, 14), Antragsstatus = "Antrag aus Datenubernahme", AuszuzahlenderBetrag = 0.00M, Eingangsdatum = new DateTime(2011, 12, 15), FaelligkeitsDatum = new DateTime(2011, 12, 25), SummeEigenbehalte = 0.00M, }); } }
public class GroupByHeaderConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value; }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value; } }
mfg. Markus
For all those interested, this issue has been resolved in the latest service release.
You can download the latest service release by going to the Infragistics website and hovering over the "Account" tab then selecting "My Keys & Downloads" from the dropdown. On the "My Keys & Downloads" page you will see a list of product keys. Select the product key assigned to the product you wish to update and then scroll down the download list until you reach the Service Releases section.
I've updated my sample to test the changes you made and I can see the issue described. It seems to only occur if there are no items in the grid to begin with. If there is at least one item in the collection beforehand, the GroupBy will work when you select the Refresh button.
I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 110416. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
In order to help you keep track of this I've opened a private case for you that is linked to the development issue. The case number is CAS-88995-HRBQPV.
Please let me know if you need more information.