UI takes time to referesh

Topics: Bugs, UI Architecture
Apr 17, 2013 at 12:52 PM
I am using this framework in my windows store application, but I found one big issue related to UI. Like I have added the code to find out some control in viewmodel but its taking time to load the control. sometimes I am getting null value. See below code-
protected override void OnViewAttached(object view, object context)
    {
        base.OnViewAttached(view, context);


       var frameworkElement = view as FrameworkElement;

        if (frameworkElement == null) return;
        playlistPage = frameworkElement.FindName("pageRoot") as Page;
        gridprogressring = frameworkElement.FindName("gridForProgressRing") as Grid;
}
Apr 21, 2013 at 3:22 AM
For which value are you getting null?
Apr 21, 2013 at 7:18 AM
I have created one grid in xaml (Name :gridForProgressRing) and i want to access this grid in ViewModel using above code.
Sometimes i am getting null value.
When i am wainting 1 milisecond using code then i am able to access grid.
Apr 22, 2013 at 1:49 AM
I would suggest using the OnViewReady override rather than OnViewAttached. I'm not 100% but OnViewAttached doesn't guarantee the video has completed loaded by this stage.
Apr 24, 2013 at 6:09 AM
I Have tried with OnViewReady method but no luck .
Can you check from your side why it is happening?
Here we are just getting control not video.
Apr 27, 2013 at 6:32 AM
Please check this issue. its very urgent.
If you can suggest another way to find out the controls in view model at initilization time, otherwise i have to recreate the whole application.
Apr 28, 2013 at 9:06 AM
please check below link i think its related to same.
http://www.baud.cz/blog/fast-switching-between-viewmodels-in-caliburn.micro
Apr 28, 2013 at 9:30 AM
I haven't been able to create this problem using OnViewReady.

In terms of work arounds, what are you actually trying to achieve through accessing the view in the view model? This isn't something that you would traditionally do in an MVVM pattern. There's most likely a way we can achieve this some other way.