I have TabControl bound directly to IEnumerable<ViewModelBase> (different ViewModels), rendered using DataTemplates. BUT when switching Tabs, one can se that TabItems are completely redrawed and it’s soooo slow. Is it normal???
I have TabControl bound directly to IEnumerable<ViewModelBase> (different ViewModels), rendered using DataTemplates . BUT
Share
Is your data context truly exposing an
IEnumerable<T>as the binding source? If so, I recommend you take a look at How Data Binding References are Resolved. This won’t explicitly address the redraw issue, but if you expose your view models data source using a collection that supports the INotifyPropertyChanged interface such as ObservableCollection or a ICollectionView data source, you will get better binding and rendering performance.On the redraw side of this issue, you should take a look at this Dr. WPF post. There is a proposed solution to the performance issue you are seeing, and to go one step further you would write a TabControl subsclass, and possibly use a VirtualizingStackPanel as the items source of the custom TabControl.
This article goes over the UI and data virtualization options you might try.