Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can only confirm that MeasureOverride uses to be the most time-consuming operation. (And you don't need a profiler to find it out.) I can only guess why does it take so long.</p> <p>First, MeasureOverride travels recursively through the visual tree of the ListBoxItem. Somewhere at the end of this call chain there's probably a call into native code that returns actual size.</p> <p>Hence keeping simple item structure is of utmost importance. </p> <p>Your structure seems to be overcomplicated. If you look at TextBox template, you will see that its structure is Grid > Border > ContentPresenter. I can't judge what is behind the ContentPresenter since I don't know your code, I just wonder why don't you use TextBlock (where possible) - it is so much more efficient.</p> <p>As an experiment I would try to implement MyListBoxItem.MeasureOverride and return fixed size without calling base implementation. I have no idea if it works, but it could bring surprising results.</p> <p>Second thing you may investigate when implementing your own list items is the frequency of the calls to MeasureOverride. (Or just look at the profiler output.) If the number of calls is too high, then the layout might take more loops than necessary. Perhaps there are some conflicting sizing requirements which need several steps to resolve.</p> <p>You mention 40 items. That should not play any role. ListBox constructs around 3 screens of ListBoxItem's, remaining items are constructed (most often reused) on as-needed basis. If the Measure time increases by increasing the item number, then look for problem in the data implementation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload