How to handle view and slow loading contents

Mar 21, 2013 at 4:47 PM
Hi,

How can I use the ModernTab control show a progress bar control during loading content?
Coordinator
Mar 21, 2013 at 7:49 PM
You mean loading content in a ModernFrame? A progressbar is automatically shown when a content load operation takes a long time (as is demonstrated in the sample application). The progressbar is part of the default ModernFrame style and made visible when the ModernFrame.IsLoadingContent property is true.
May 23, 2013 at 4:21 PM
It is possible to activate/deativacte the progress bar "manually"?
Coordinator
May 24, 2013 at 3:08 PM
The progress bar is in the default ModernFrame style. Create your own style if you want to show a progress bar based on custom conditions.
May 29, 2013 at 9:09 PM
kozw wrote:
A progressbar is automatically shown when a content load operation takes a long time (as is demonstrated in the sample application).
Where exactly?
Coordinator
May 29, 2013 at 9:44 PM
In the content loader flickr image page (advanced > content loader > images), when selecting an image, a progressbar is shown at the top of the frame.
May 29, 2013 at 11:08 PM
Hmm, I expected this. Couldn't you use an example where no flickr API key or a registration at all is needed? e.g. Task.Delay() ...

Btw. I try to use MUI with Telerik's RadGridView. Right now I didn't find out how to combine both w/o performance issue. The RadGridView needs a lot of time in MeasureOverride(). Telerik's documentation lists some reasons. But giving the Grid in the UserControl both Witdh and Height doesn't help. Even with only 100 sample data records in a List shows a delay in navigating to and especially from the page. Also there is no transition animation. I tried to set the DataContext in OnNavigatedTo() but the delay appears after leaving this method and then the content becomes visible. I don't know how to catch an event or something other after the page becomes visible. But I think this is not the solution. Setting DataContext to null in OnNavigatingFrom() the delay is gone, but also the information of scroll position/filtering/grouping/...
Coordinator
Jun 3, 2013 at 10:02 PM
The progressbar works fine when the task at hand is being executed on a background thread. MeasureOverrride typically executes on the UI thread and will block the entire UI when this takes a long time.
Jun 5, 2013 at 11:46 AM
That's right, but I now found out that the transition makes it even worse. It leads to a call of MeasureOverride when both navigating from and to. For now I set
<Style TargetType="mui:TransitioningContentControl"><Setter Property="Transition" Value="Normal" /></Style>
That's a lot better but still not the solution. I have to investigate further. (It is also remarkable that MeasureOverride is not called with infinity, what the documentation says is one of the reasons.)
Coordinator
Jun 5, 2013 at 12:11 PM
MeasureOverride is invoked twice since ModernFrame works with a TransitioningContentControl containing two content presenters; one for the current content and one for the previous content which is there for smooth transitions. Your approach by disabling the Transition sounds like a smart move.
Sep 8, 2013 at 10:38 PM
felixdd, could you please tell me where did you exactly place that last piece of code? Thank you very much.
Sep 9, 2013 at 8:01 AM
A Style for a TargetType that should apply to everything in your MainWindow should be at least placed into the MainWindow's Resources section (i.e. <mui:ModernWindow.Resources>). It should also work in the Application.Resources.
Sep 9, 2013 at 2:20 PM
Thank you!
Feb 26, 2014 at 8:19 PM
felixdd wrote:
Hmm, I expected this. Couldn't you use an example where no flickr API key or a registration at all is needed? e.g. Task.Delay() ...

Btw. I try to use MUI with Telerik's RadGridView. Right now I didn't find out how to combine both w/o performance issue. The RadGridView needs a lot of time in MeasureOverride(). Telerik's documentation lists some reasons. But giving the Grid in the UserControl both Witdh and Height doesn't help. Even with only 100 sample data records in a List shows a delay in navigating to and especially from the page. Also there is no transition animation. I tried to set the DataContext in OnNavigatedTo() but the delay appears after leaving this method and then the content becomes visible. I don't know how to catch an event or something other after the page becomes visible. But I think this is not the solution. Setting DataContext to null in OnNavigatingFrom() the delay is gone, but also the information of scroll position/filtering/grouping/...
I have a similar issue where I have a MVVM page and when navigating to it i call its default constructor from the OnNavigatedTo method - I tried putting the call to base.datacontext = ... in a background thread but that does not seem to help

For some reason I cannot get the progress bar to come up while loading - the entire UI freezes for tor those 2-3 seconds it takes to load and the users want some indication of loading...

Has anyone had a similar issue or knows what the problem is?
Mar 4, 2014 at 4:01 PM
Edited Mar 4, 2014 at 4:01 PM
After a few days of exploring modern XAML pages and code I pretty I decided to try to add some performance improvements on my side seeing as it didn't look like MUI will let me do anything to improve it. On a side note anything in the MUI framework is hard to modify as everything runs off a resource dictionary.. might have been better to make it more open and edit friendly.

I found out that my view model was holding up the page because of the many getter properties in there and I ended up making it async to speed up the page load.. it about halved the time it was taking before.