Hi
I've got a tab control with about 6 charts on each tab. When switching tabs the charts on theselected tab re-renders themselves, is there a way to stop this from happening each time thetab is selected?
Might be some help here for anyone interested.
http://stackoverflow.com/questions/2080764/wpf-tabcontrol-how-to-preserve-control-state-within-tab-items-mvvm-pattern
Yes I think its the WPF tabcontrol and NOT the Infragistics one.
My UI has a content area with tabs - I list records in one tab and when the user selects a record I display it in another tab. My edit forms consist of user controls that are loaded into the content pane.
The problem is, the WPF TabControl raises an Unload event to any user controls hosted in the tab when you select another tab. This is causing me some UI pain as my usercontrols try and reload when you click back - some values disappear from combo boxes (typically ones where they are based on another dropdown and I reset them in code-behind). But essentially, the tab control is causing my user controls to unload when I don't want them to.
I've read that WPF likes to do this for performance reasons, but unloading your usercontrol from the visual tree causing the unload event to fire on the control, and then reloading it seems a bit of an assumption on it's part.
Although this is off topic, I'd love to hear any ideas on how to stop the WPF tabcontrol from doing this?
Maybe I need to store a reference to the control, so that when it gets unloaded I still have it in memory and can restore it when the tab gets focus again.
i believe that's how the tab control works ... or are you saying that the chart never gets re-added to the UI when you switch back to its tab?
Did this ever get fixed?
I'm suffering the same problem with the chart being removed from the visual tree when I tab off and then back onto the tab. It works with other controls, just not any of the charts.
i don't think redrawing the chart can be avoided in this case. if you handle the control's Load event, you will see it's raised every time you change to that tab, which is some evidence of our problem. if i learn of a better solution, i'll be sure to implement it in the chart.
regarding that other post you refer to; we have a solution in the works that should resolve peoples' concerns about performance.