Home Forums WPF controls Xceed DataGrid for WPF Items not generating when grouping

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22329 |

    I thought I’d seen this somewhere in the forum but can’t find it now.

    If one or more columns have been dragged into the header to enable grouping, items are not generated correctly when the ItemsSource changes.

    In my case, the ItemsSource is bound to a DataTable. When the DataTable changes, the items in the grid should be cleared and new items and groups generated but this is not happening. The grid continues to show items from the old source though not all of them – very odd!

    If I remove the grouping, the grid displays the correct items. I can then set the groups again and all is fine until the next DataTable refresh.

    I’m guessing this is a bug in the VirtualizingStackPanel. Is there a way to turn virtualization off for the time being?

    Michael

    Imported from legacy forums. Posted by Michael (had 6289 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Michael,

    We did not experience this kind of behavior up to now, I’d be interested in having more description on what are the changes on the DataTable, in order to be able to reproduce this behavior.

    As for turning off the Virtualization, you can do that by creating an implicit style for the TableViewScrollViewer.

    <code>
    <Style TargetType=”{x:Type xcdg:TableViewScrollViewer}”>
    <Setter Property=”CanContentScroll”
    Value=”False”/>
    </Style>
    </code>

    Imported from legacy forums. Posted by Marcus [Xceed] (had 405 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Marcus,

    Turning Virtualization off didn’t help.

    I’m using WCF to issue queries against SQLServer. Something like this (much abbreviated):-

    public class NotesDataModel : INotifyPropertyChanged
    {

    public void SelectNotes(int userID)
    {
    ProfileServiceClient ps = new ProfileServiceClient();
    ProfileDS.NotesDataTable dt = ps.SelectNotes(userID);

    this.NotesData = dt;
    }

    public ProfileDS.NotesDataTable NotesData
    {
    get
    {
    return _notesData;
    }
    private set
    {
    if (_notesData != value)
    {
    _notesData = value;
    SendPropertyChanged(“NotesData”);
    }
    }
    }

    }

    The DataGrid is bound to the above property like so:-

    <CollectionViewSource Source=”{Binding Path=NotesDataModel.NotesData}” x:Key=”notesDataView” />

    <xcdg:DataGridControl x:Name=”grid”
    AutoCreateColumns=”False”
    ItemsSource=”{Binding Source={StaticResource notesDataView}}”
    CellEditorDisplayConditions=”CellIsCurrent”
    EditTriggers=”BeginEditCommand,CellIsCurrent,ActivationGesture”
    ValidationMode=”RowEndingEdit”>

    So every time SelectNotes is called, a new instance of a DataTable is returned though the schema and underlying table don’t change.

    I’ve used the above code bound to a ListView with GridView and the grouping works as expected.

    In your grid, the GroupHeaderControls are not cleared. All items from the old table are removed except for the first item in the first group. If I drag the column name out of the GroupByControl to remove grouping then all items from the new table are displayed.

    HTH. Let me know if you need anything more.

    Michael

    Imported from legacy forums. Posted by Michael (had 435 views)

    Xceed Support
    Member
    Post count: 5658

    This should allow me to kick start my investigation, thanks…

    Whenever I find something, I’ll post back in this thread. But as a general comment, the code that handles these things is being refactored for several reasons, so I’m pretty confident that such behavior will be addressed.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 396 views)

    User (Old forums)
    Member
    Post count: 23064

    Related to this:-

    If I drag two column headers into the GroupByControl, refresh the ItemsSource and then try and drag one of the columns out of the GroupByControl, it crashes. The problem seems to be in GroupLevelIndicatorPane.MeasureOverride.

    Relevant part of the stack dump below:-

    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
    at System.ThrowHelper.ThrowArgumentOutOfRangeException()
    at System.Collections.Generic.List`1.get_Item(Int32 index)
    at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
    at Xceed.Wpf.DataGrid.GroupLevelIndicatorPane.MeasureOverride(Size availableSize)
    at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
    at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
    at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
    at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at System.Windows.Controls.Control.MeasureOverride(Size constraint)
    at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at Xceed.Wpf.DataGrid.VirtualizingStackPanel.MeasureOverride(Size availableSize)
    at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
    at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
    at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)

    I guess if you are refactoring this code the above may not apply but its something to test when you are done.

    … And on that note, is the refactoring intended for the next update and can you give any rough indication of when that might be?

    Thanks
    Michael

    Imported from legacy forums. Posted by Michael (had 465 views)

    Xceed Support
    Member
    Post count: 5658

    After investigation, I found that both these issues (artifacts and exception) are resolved via the refactoring mentioned.

    The refactoring is currently scheduled to be release along with version 1.1 of the Xceed DataGrid for WPF, which is due early may.

    The complete and exact content of version 1.1 cannot be disclosed at the moment, also be aware that release date is not “hard” and does not represent a commitment.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 500 views)

    User (Old forums)
    Member
    Post count: 23064

    Version 1.1 is ready you can obtain it <a href=”http://download3.xceedsoft.com/Packages/3.0.7264.16200/XceedComponents.exe”>here</a&gt;.

    Thank you !

    Imported from legacy forums. Posted by Matt (had 474 views)

    User (Old forums)
    Member
    Post count: 23064

    I think there are still problems here in V1.1.

    I have two ContentControls with a DataGridControl in each. The UI enables the user to switch the ContentControls in and out of a ContentPresenter rather like a TabControl except that the controls are disconnected from the VisualTree when not visible. When I switch between the two the grouping stops working.

    I’ll try and do some more digging tomorrow but it certainly looks like there is still a problem.

    I also got a StackOverflowException:-

    An unhandled exception of type ‘System.StackOverflowException’ occurred in Xceed.Wpf.DataGrid.dll

    though I haven’t been able to reproduce it as yet.

    Michael

    Imported from legacy forums. Posted by Michael (had 470 views)

    Xceed Support
    Member
    Post count: 5658

    If you are able to reproduce this issue, having access to your reproduction code would help us a lot…

    Let me know if this is a possibility.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 392 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve modified the DataBinding sample to reproduce the grouping problem and emailed to support@xceedsoft.com.

    Michael

    Imported from legacy forums. Posted by Michael (had 8688 views)

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.