How can I access from a variable in MainPage.cs like "public static int intHallo = 5;" in another class of an App like BlankPage2.cs? Static does not work?
Greetings from Hannover Christian
How can I access from a variable in MainPage.cs like "public static int intHallo = 5;" in another class of an App like BlankPage2.cs? Static does not work?
Greetings from Hannover Christian
If you want a global variable, define these in App.Xaml.cs
public static int IntHallo = 5
public static new App Current
{
get { return Application.Current as App; }
}
Then you can use it on the OnNavigated to.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Test.Text = App.IntHallo;
}
If you want to pass parameters between XAML pages, follow this: How to pass values (parameters) between XAML pages?