Suggestions WPF UI?

I have a user interface with some controls, then in the middle I have 6 overlapping grids. I use these grids as “pages”, and when the user goes through the “page” I loop, using Visible.Hidden and Visible.Visible to show the correct page.

I noticed that during development, as I added more grids, the application began to slow down (a lot). This was not a problem until I added 6 more images to the last page. Since the application runs very slowly even on my (faster than average) PC.

Do you have any tips on how I can achieve the same look but use a more efficient method?

Thanks in advance.

+4
source share
3 answers

In general, it’s nice to have a bunch of overlapping controls like yours because, as you noticed, there are performance issues. You want to minimize the number of controls that are present in your application at any given time.

If you have a limited number of pages, use TabControl .

If you have a large or dynamic number of pages, consider Frames and Page .

The third option is to have shell hosting management with ContentPresenter . Then, when you want to go to another page, just set the Content control to a new instance of your page view.

Your views are separate from your data models, right? If not, consider the template

+2
source

I suggest using the WPF frame classes and pages instead of the current architecture. As with any presentation environment, performance degrades as additional controls are added to your scene graphics.

+1
source

TabControl with custom template?

0
source

Source: https://habr.com/ru/post/1301298/


All Articles