If I have 1 tabcontrol and 2 tabitems each containing a datagrid and load them on startup of the application the memory level is normal.
If I have 2 tab controls and each tabcontrol has 1 tabitem and i load them on startup of application memory goes crazy.
What am I doing wrong?
I am loading them the exact same way in both cases the 1 of the datagrid are using in a different control.
I could be wrong but I'm guessing that it's because that if you have one tab control with 2 tabs WPF only has to draw one of the datagrids at a time but if 2 tab controls are present WPF is drawing both of the data grids at the same time so it is going to use up more memory.
Not sure though!
Related
I have a C# 4.0 Winform app, the main form of which is visually divided in half: a TreeView on the left (for navigation of data) and a FlowLayoutPanel on the right. The contents of the FlowLayoutPanel changes based on user interaction (mainly with the TreeView).
The content to be shown in the FlowLayoutPanel is comparmentalized into a number of "blocks" - some are UserControls whilst others (I'm embarrassed to say) are Panels containing various Controls.
My issue is that the number of "blocks" is now too many to see in the Visual Studio form designer, and I can't make the form large enough to see them all; this makes it hard to verify how the UI will look without running it.
How can I manage the contents of the FlowLayoutPanel so that I can see all of the controls, or am I going about it wrong?
While in the designer, make sure you have AutoScroll property set to true, which will enable you to scroll the FlowLayoutPanel child controls while in the designer view.
We are creating 8 usercontrols to show graphs of 8 patients inside a listview. The issue is that the usercontrols when zoomed-in are not totally opaque. Due to which the the items behind that usercontrol is also visible inside it. Please suggest what could be the cause.
I am building an application based on MVVM approach shown in an article by josh smith. One of my user control has many controls (3 data grids and other controls) due to which its size has gone past the size of normal window. I tried adding a scrollviewer to the user control so that the user can scroll to see the hidden controls but the scrollviewer is not working. it is shown as disabled and during runtime the usercontrol only shows the controls visible in normal window size. The other controls are truncated. Can anyone please let me know how to add scrollviewer to workaspaces so that it can work effectively.
I am loading the workspaces suggested by Josh Smith in his article.
I'm building a WPF application to visualize a load of items (a few thousand). For this i'm using an ItemsControl of which the ItemsSource is set to a BindingList.
I've noticed that it takes some time to initialize the screen... The main bottleneck is the creation of TextBlock elements (the data template of the items contains 4 TextBlock elements). Once the screen is initialized (when all WPF elements are created), rendering is quite OK.
I've implemented zooming and panning, so i was thinking about making the appearance of the items dependent on the zoom level and the center point (a bit like Google Maps: data is only visualized for regions that are into the view).
How can this be done? Is there any way in WPF to ask the item or item container if it is currently clipped?
You can make your list virtualized. This way only the items that are visible will have UI controls created for them.
Check the ListView documentation, or this link may help:
http://www.codeproject.com/KB/WPF/WpfDataVirtualization.aspx
Jogy
Hi My usercontrols placed in tabs are unloaded and loaded every time the tabs are changed.It creates some unnecessary lag in the application.I am looking for some way to fix this behavior.I know i have to subclass tabcontrol to change this behavior but how..?
You can find two different approaches to prevent this in this StackOverflow question:
WPF TabControl - how to preserve control state within tab items (MVVM pattern)
I recommend:
Keeping the WPF Tab Control from destroying its children