Tuesday, January 24, 2012

Using Busy indicator of Master Page from the Child Page in MVVM structure of Silver light

You can call the busy indicator of silver light master page from the child form in the following way..

1. Register the Message in constructor of MasterPage View Model

public vmMasterPage()
{
   //Your other work
   Messenger.Default.Register(this, "GetBusy", getBusy);
}

2. Define the function in MasterPage view Model
public void getBusy(string msg)
        {
            //MainPageBusyIndicator is bool property to bind with busyindcator control on masterPage
            //
            if (msg == "Busy")
            {
                MainPageBusyIndicator = true;
            }
            else
            {
                MainPageBusyIndicator = false; 
            }
        }

3. Call This Message from your Child form as follows
Messenger.Default.Send("Busy", "GetBusy");



No comments:

Post a Comment