locked
UI Rendering Issue with Tab and Datagrid control RRS feed

  • Question

  • Dear Friends

    A Very Good Evening to All !

    I have problem in with WPF Tab Control.  Below is the explaination of scenario.

    I have a WPF Tab Control having multiple tabs in it. Inside every tab i have a Datagrid which is used for binding data.

    I have only one Datagrid used under all Tabs for binding different data everytime user switch between the tabs.

    exmaple say i have TAB -A Tab-B

    Tab A having a datagrid named "mydatgrid"  is binded with a collection containing huge amount of data say more than 100 rows at a time.

    when user clicks on Tab-B the same Datagrid is binded with the new data Collection .  And this same scenario is applied with other Tabs as well.  All multiple tabs uses same Datagrid to bind their respective Datasource as per the funcationality of that selected Tab.

    I hope the above picture is clear to you for understanding what is happening ? Now Question or problem ---

    While i switch between the multiple Tabs and binding happens in Datagrid,  application takes much time to render the UI though the whole application is Asnchronous using Background threads for fetching the data. Application follows standrd development practice using async model. The UI thread is independent of background thread processing but still while switching between the Tabs the rendering time taken is more than the usual time.

    I am not able to understand why  it is happening ? What is the alternate solution for making UI rendering faster while switching between the Tabs containing Datagrid.

    I hope i am able to express my problem clearly if still any doubts you have please reply asking me i will try to eleborate in better way.

    Please reply how can i make the rendering of the Tab containing Datagrid UI faster while switching between the multiple Tabs.

    Thank you

    Regards

    Vijay Gaur

    Tuesday, December 21, 2010 12:51 PM

Answers

  • I personally wouldn't think a TabControl with a DataGrid on each tab would be considered 'heavy'.  The tabs that are not visible are not even rendered, so the only difference is a slight memory increase possibly.  You can try some virtualization techniques like I mentioned above, but as a user I wouldn't want any hesitation between switching tabs, and its tough to get around the initial render time when changing bindings.

    Hope this helps.

    KP

    • Proposed as answer by Sheldon _Xiao Wednesday, December 29, 2010 11:41 AM
    • Marked as answer by Sheldon _Xiao Thursday, December 30, 2010 2:58 AM
    Wednesday, December 22, 2010 12:14 PM
  • Hi All,

    Sorry for my jumping in.

    Hi Vijay1984,

    Welcome to our forum.

    I think KP_SES's reply is very help for you, could you tell me the situation of your issue?

     

    Best regards,


    Sheldon _Xiao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Vijay1984 Thursday, December 30, 2010 8:06 AM
    Monday, December 27, 2010 7:14 AM

All replies

  • You should really use a separate DataGrid under each TAB if you want to see good performance.  The DataGrid is a heavy control, and when it is bound to many records it is slow rendering for the first time (when it is creating the new rows, etc..).  You can speed things up by using:

      EnableRowVirtualization="True"
      EnableColumnVirtualization="True"

    VirtualizingStackPanel.IsVirtualizing="True"

     

     I would suggest separate DataGrids for each Tab.

    Tuesday, December 21, 2010 1:14 PM
  • KP_SES Thanks for thre rpely !

    Is there any other solution than keeping separate Datagrid. Is there some way to achieve better rendering with single Datagrid as stated above. Including separate Datagrid for each tab ,  is it a right approach? wont it make the application heavier by having so many instance of Datgrid in various tabs. And what in case where tabs are ceated on user's demand everytime a new tab is created containing a new datagrid inside that tab. I want to know wont it make the application heavier by including the Datgrid separately for each Tabs.

    Or is there any better solution...

    Please reply

     

    Thanks

    Regards

    VIJAY

    Wednesday, December 22, 2010 4:22 AM
  • I personally wouldn't think a TabControl with a DataGrid on each tab would be considered 'heavy'.  The tabs that are not visible are not even rendered, so the only difference is a slight memory increase possibly.  You can try some virtualization techniques like I mentioned above, but as a user I wouldn't want any hesitation between switching tabs, and its tough to get around the initial render time when changing bindings.

    Hope this helps.

    KP

    • Proposed as answer by Sheldon _Xiao Wednesday, December 29, 2010 11:41 AM
    • Marked as answer by Sheldon _Xiao Thursday, December 30, 2010 2:58 AM
    Wednesday, December 22, 2010 12:14 PM
  • Hi All,

    Sorry for my jumping in.

    Hi Vijay1984,

    Welcome to our forum.

    I think KP_SES's reply is very help for you, could you tell me the situation of your issue?

     

    Best regards,


    Sheldon _Xiao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Vijay1984 Thursday, December 30, 2010 8:06 AM
    Monday, December 27, 2010 7:14 AM