UI Crash with Update itemsource which was a over 6000 columns will stop UI

3 posts, 0 answers
  1. Mengjie
    Mengjie avatar
    5 posts
    Member since:
    Jul 2015

    Posted 15 Jan Link to this post

    If my itemsource already has a very large datatable source for example with 6000+ columns and one line then update it to a small table by changing the itemsource. 

    private static void OnItemsSourcePropertyValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
                var dynamicGrid = d as DynamicGrid;
                if (dynamicGrid == null)
                    return;
                try
                {
                    dynamicGrid.ItemsSource.Dispose();
                    dynamicGrid._grid.SelectedItems.Clear();
                    dynamicGrid._grid.SelectedItem = null;
                    dynamicGrid._grid.Rebind();
                    dynamicGrid.ItemsSource = null; stop here and no exception,code stop running
                    dynamicGrid.ItemsSource = e.NewValue as DataTable;   
                }

    }

     

  2. Mengjie
    Mengjie avatar
    5 posts
    Member since:
    Jul 2015

    Posted 15 Jan in reply to Mengjie Link to this post

    public DataTable ItemsSource
            {
                get { return (DataTable)GetValue(ItemsSourceProperty); }
                set
                {
                    SetValue(ItemsSourceProperty, value);

                    _radDataPager.Source = value != null ? value.DefaultView : null;
                }
            }
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petya
    Admin
    Petya avatar
    975 posts

    Posted 20 Jan Link to this post

    Hi Mengjie,

    I'm not aware of the specific implementation at your end, but it looks like you're setting the ItemsSource property in the change callback for the ItemsSource property. My guess is this is causing an infinite cycle and that's why you're observing the crash. Could you try moving the code to see if that resolve the issue?

    Regards,
    Petya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top