Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Tabcontrol Measure override called unnecessarily

$
0
0

I have used the DataGrid inside the usercontrol and update the data of DataGrid in timer tick by random data. If I use this usercontrol in TabControl SelectedContent, measure override called unnecessarily until resize.

usercontrol:

<Grid><DataGridItemsSource="{Binding Rows}"/></Grid>


mainwindow:

<mytabcontrol  ><TabItemHeader="Tab"><local:myusercontrol ></local:myusercontrol></TabItem></mytabcontrol>

viewmodel:

publicsealedclassViewModel{privatereadonlyDispatcherTimer _dispatcherTimer =newDispatcherTimer{Interval=TimeSpan.FromMilliseconds(250)};publicViewModel(){Rows=newObservableCollection<DataRow>();for(int i =1; i <=250;++i)Rows.Add(newDataRow(i));

            _dispatcherTimer.Tick+=DispatcherTimer_Tick;
            _dispatcherTimer.Start();}publicObservableCollection<DataRow>Rows{ get;privateset;}privatevoidDispatcherTimer_Tick(object sender,EventArgs e){foreach(var row inRows)
                row.Update();}}

with the viewmodel I provided datagrid's height and width remains the same for every data's.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>