Thursday, December 24, 2009

Silverlight How To Pass Values Between Pages or Forms

In App.xaml.cs have declared some application level variables as follows,

private string valueToPass

public string valTo
{
    get
    {
        return valueToPass;
    }
    
    set
    {
        valueToPass = value;
    }
}

page1.xaml.cs

App ap = (App)Application.Current;
ap.valueToPass = "YourValue";


page2.xaml.cs

App ap = (App)Application.Current;
messageBox.show(ap.valueToPass);



No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.