Home Forums WPF controls Xceed DataGrid for WPF DataGridControl "clears" the Items, when changing ItemSource

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

    Hello,
    I have recently updated the DataGridControl, from 1.0 to 1.1:

    Xceed.Wpf.DataGrid, Version=1.1.7326.14130

    Now, I discovered that my Grids “clears” (after a delay for a lot of seconds) the Items, when rebinding (setting the second time the ItemSource…)

    any suggestions?

    Imported from legacy forums. Posted by serhio (had 392 views)

    User (Old forums)
    Member
    Post count: 23064

    In fact, the number of rows remains as in a updated grid (420 in my case) , the number of columns too…
    When debugging, I observed that the content of Rows is filled with data, … but in GUI I see only the empty lines..

    Imported from legacy forums. Posted by serhio (had 308 views)

    User (Old forums)
    Member
    Post count: 23064

    A quick observation… if you aren’t already doing so, maybe wrapping your unbound data in DataGridCollectionView or ObservableCollection will give you a different result:

    http://doc.xceedsoft.com/products/XceedWpfDataGrid/Providing%20Data.html

    I don’t have any experience using unbound data Items collections.

    Imported from legacy forums. Posted by Richard (had 311 views)

    User (Old forums)
    Member
    Post count: 23064

    After writing my earlier post, I realize you may be using ItemsSource on bounded data, but on your 2nd post the subject was truncated from “ItemsSource” to “ItemSo”, which I took to mean “Items”.

    Here’s what I do to switch ItemsSource in my C# code. Note, a lot of code that creates my columns is omitted as I do this in code.

    Code from a derived grid class

    class MySpecialXceedGrid : DataGricControl
    {

    private OnSpecialDependencyPropertyUpdate(…)
    {

    this.BeginInit();

    … code to create the grid columns and column editors for MyCollection omitted …

    BindingListCollectionView bindingListView

    CollectionViewSource.GetDefaultView(MyCollection) as BindingListCollectionView;

    // using IBinding list if available
    // because of forum post http://forums.xceed.com/forums/ShowPost.aspx?PostID=7808

    IBindingList ibl = (IBindingList)TheXpoCollection;

    DataGridCollectionView dgcv = null;
    if (ibl != null)
    {
    dgcv = new DataGridCollectionView(ibl);
    }
    else
    {
    dgcv = new DataGridCollectionView(bindingListView);
    }
    this.ItemsSource = dgcv;
    this.EndInit();
    this.UpdateLayout(); // not sure if this is needed

    }


    }

    Imported from legacy forums. Posted by Richard (had 3673 views)

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