Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:47:29+00:00 2026-06-16T04:47:29+00:00

I have a view in my application with huge table like data to display.

  • 0

I have a view in my application with huge table like data to display. The data is displayed in two nested UniformGrids. The UniformGrids are ItemPanels in ItemsControls and are bound to some ViewModels. See the following image and some example XAML-Code:

view and viewmodel http://img593.imageshack.us/img593/8825/stackoverflowuniformgri.png

<!-- The green boxes -->
<ItemsControl ItemsSource="{Binding BigCells}">

  <ItemsControl.ItemPanel>
    <PanelTemplate>
      <UniformGrid />
    </PanelTemplate>
  </ItemsControl.ItemPanel>

  <ItemsControl.ItemTemplate>
    <DataTemplate>

      <!-- The blue boxes -->
      <ItemsControl ItemsSource="{Binding SmallCells}">
        <ItemsControl.ItemPanel>
          <PanelTemplate>
            <UniformGrid />
          </PanelTemplate>
        </ItemsControl.ItemPanel>
      </ItemsControl>

    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>

Now, I want my view to be resizable but this does not perform well at all since every single small box’s layout is computed.
This could at least for the boxes size be done only once, since it is equal for all boxes.

What is best practice to display a huge amount of controls in WPF / where could I start optimizing? Keywords would already help me to continue discovering performance optimizations for UniformGrids in WPF.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:47:31+00:00Added an answer on June 16, 2026 at 4:47 am

    I’ve had a similar problem when using a lot of WPF DataGrid at the same time. It finally came down to two major issues :

    • Resource dictionaries
    • Bindings

    Resource Dictionaries

    Those can be major bottlenecks if you use basic WPF features without being careful.

    In my case, for a single logical scroll in the ItemsControl that was containing my DataGrids, I was getting something like 10 millions call to GetValue and GetValueWithoutLock on ResourceDictionary. More than 1 second to process.

    This major number of ResourceDictionary accesses was caused by different sources :

    • Dynamic resource retrieval : If you have ControlTemplates, and more generally resources placed in some resource dictionaries, and you access them via {DynamicResource ...}, remove them. Have some static somewhere and acces them directly.
    • Style fetching : If you have no style on the different Visual you use, or if you have a Style but didn’t set the FrameworkElement.OverridesDefaultStyle property, WPF will try to find a style matching the control in all the resources, which result in a lot of accesses to resources dictionaries. To avoid that, be sure to override all of the control templates of your controls, and set Style={x:Null} on each and every control (if you need a style for a control, set it inline on your control, and add OverridesDefaultStyle = true)
    • Implicit DataTemplates : Implicit data template are very usefull but are far from free to. When looking for a DataTemplate to apply, WPF will once again browse your resource dictionaries to find a DataTemplate matching your ViewModels types. Solution is to use a DataTemplate selector for each and every control binded to a ViewModel, and implement an optimized way to retrieve the correct DataTemplate. (I personally have some static fields for my dataTemplate that I retrieve only once from a resourceDictionary, and an optimized DataTemplateSelector that returns them as needed.)

    Bindings

    Bindings are very useful, but very expensive, memory wise and performance wise. In a very sensible environement – from a performance point of view – you can’t just use them without being carefull. For exmample, binding can create up to 3 WeakReferences for each binded object, can use reflection, etc. I finally ended up with removing almost all of my binding and plugged event handler on my DataContext’s PropertyChanged event. When DataContext changes on my Controls (you have a DataContextChanged event) I test if my DataContext supports INotifyPropertyChanged, and if it’s the case, I attach an event handler on PropertyChanged event and update properties as needed. (I only had one way bindings, so this is why I chose this way of doing things, but there are other solutions).

    It can seems frustrating not using bindings when using MVVM and WPF, but there was actually no way to optimize bindings in my case.

    Last thing : if you have Freezable objects (like Brushes for example), don’t hesitate to Freeze them if you can.

    Those are some advices that can help you optimizing your code. You will need a profiler (I always advice using dotTrace as this is the best profiler I ever used) to monitor what’s really happening and adapt your according to the results.

    Good luck !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application where i have two view controllers my first view and second
I have an MVC application view that is generating quite a large HTML table
In my application,i have text view with long text. i need text wrapping like
I have one view in iPhone application. In that view i added two UIImageView
I have a single-view application that takes in a username and a password and
I have a single view application. It has myAppDelegate and myViewController. In a earlier
I have a multi view application with individual UIViewControllers and xibs. I have one
I have an view-based application where the user can do a lot of customization
I have made a view in the application that shows a UITableView. It will
I have a web-view running JavaScript application, and sometimes it freezes/hangs when the main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.