ObservableCollection and ListBoxItem DataTemplate generation problem

后端 未结 3 1328
余生分开走
余生分开走 2021-01-15 05:55

Something strange is going on with ObservableCollection.

I have the following code:

private readonly ObservableCollection _displa         


        
3条回答
  •  梦毁少年i
    2021-01-15 06:21

    The wpf layout engine won't have been through the layout and arrange pass so your listboxitems won't have been given a size yet. Sticking in the message box will allow the background threads that do this run. Try forcing a call to Measure() on your items before looking at their size.

提交回复
热议问题