Bad performance ListView in TabControl WPF -


i have tabcontrol 3 tabitems. each tabitem has own viewmodel. last tab contains listview +1500 records. every time open tab, takes +-10 seconds render. want optimize listview doesn't take long render every time.

i'm binding observablecollection listview.

the listview looks this

<listview>     <listview.view>         <gridview>             <gridviewcolumn>                 <gridviewcolumnheader>                    <textbox... custom templates filtering here                 </gridviewcolumnheader>             </gridviewcolumn>             </gridview>     <listview.view> </listview> 

i've tried:

<virtualizingpanel.virtualizationmode="recycling"> 

this speeds up, makes scrolling reeeeeeeally slow.

i think can separate big collection on few small pages (20/50 items) , add new items little. can recommend use behavior refresh page. bind awaitable command add new items collection. new items adding while scrollig down.

internal class scrollendtocommandbehavior : behavior<scrollviewer> {     #region public static fields , constants      public static readonly dependencyproperty commandparameterproperty =         dependencyproperty.register("commandparameter", typeof (object), typeof (scrollendtocommandbehavior), new propertymetadata(null));      public static readonly dependencyproperty commandproperty =         dependencyproperty.register("command", typeof (icommand), typeof (scrollendtocommandbehavior), new propertymetadata(null));      #endregion      #region public properties      public icommand command     {         { return (icommand) getvalue(commandproperty); }         set { setvalue(commandproperty, value); }     }       public object commandparameter     {         { return getvalue(commandparameterproperty); }         set { setvalue(commandparameterproperty, value); }     }      #endregion      #region protected methods      protected override void onattached()     {         base.onattached();         associatedobject.viewchanged += associatedobjectonviewchanged;     }      protected override void ondetaching()     {         associatedobject.viewchanged -= associatedobjectonviewchanged;         base.ondetaching();     }      #endregion      #region private methods      private void associatedobjectonviewchanged(object sender, scrollviewerviewchangedeventargs eventargs)     {         if (!eventargs.isintermediate && math.abs(associatedobject.scrollableheight - associatedobject.verticaloffset) < 5)         {             command?.execute(commandparameter);         }     }      #endregion } 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -