WPF Datatemplate + ItemsControl each item uses > 1 MB Memory?
- by Matt H.
Does that sound right to anyone????
I have an ItemsControl that displays data from a custom object that implements iNotifyPropertyChanged. The DataTemplate consists of:
Border
3 buttons
5 textboxes
An ellipse
A Bindable RichTextBox (custom class that inherits from RichTextBox... so I could make Document a dependency property (to support binding))
Several grids and stackpanels for layout
It uses:
Styles (stored in a resource dictionary higher up the tree)
Styles affect: colors, thicknesses, and text properties: which are data-bound to a "settings" class that implements iNotifyPropertyChanged, so the user can change display settings
That's it!
So what gives?
I've also noticed that when I empty and remove the ItemsControl, memory isn't freed. over 5000 instances of "CommandBindingCollection" and "WeakReference" are CREATED (using ANTS profiler). And huge number of EffectiveValueEntry objects are created too.
So really, what gives!!! :-)
Thanks for your insight! Management needs this project soon but in its current state, it's unreleasable.