c# - VirtualizingStackPanel on a Treeview ist not Virtualizing -


i've got problem here, want show items in treeview, 100.000 elements. if use default wpf treeview seems work, if use custom-treeview (which @ moment itemscontrol), virtualization doesn't seem work anymore. while researching on web, i've tried solutions none of them seems work... here's xaml:

<style targettype="{x:type my:multiselectiontreeview}">     <setter property="treeview.background" value="transparent"/>     <setter property="virtualizingstackpanel.isvirtualizing" value="true"/>     <setter property="virtualizingstackpanel.virtualizationmode" value="recycling"/>     <setter property="treeview.overridesdefaultstyle" value="true" />     <setter property="itemscontrol.itemspanel">         <setter.value>             <itemspaneltemplate>                 <virtualizingstackpanel isitemshost="true"/>             </itemspaneltemplate>         </setter.value>     </setter>     <setter property="treeview.template">         <setter.value>             <controltemplate targettype="{x:type my:multiselectiontreeview}">                 <border background="{templatebinding background}"                     borderbrush="{templatebinding borderbrush}"                     borderthickness="{templatebinding borderthickness}">                     <scrollviewer focusable="true" cancontentscroll="true"                                    padding="4"                                    verticalscrollbarvisibility="auto">                         <itemspresenter horizontalalignment="stretch"/>                     </scrollviewer>                 </border>             </controltemplate>         </setter.value>     </setter> </style> 

the items in observablecollection databinding, shouldn't problem... it???

greets,

jürgen

the virtualizingstackpanel has special code looks treeview , treeviewitem. in addition, treeviewitem implements virtualizingstackpanel.iprovidestackingsize, internal interface won't able implement.

so if trying replicate hierarchical structure of items in treeview, you'd have derive treeview use virtualization (not itemscontrol).


Comments