Saturday, January 4, 2014

How to navigate image source to another xaml? c# windows store app

Decalre class in another class file.



private void button1_Click(object sender, RoutedEventArgs e)
{
}



file : abc.cs:



public class abc
{
public string str1 { get; set; }
public ImageSource image1 { get; set; }
}

button click event:



private void button1_Click(object sender, RoutedEventArgs e)
{
abc a1 = new abc();
a1.str = txtbox1.text;
a1.image1 = bg2;
this.Frame.Navigate(typeof(MultiGame),a1);
}

multigame.xaml.cs :



protected override void OnNavigatedTo(NavigationEventArgs e)
{
abc a1 = e.Parameter as abc;
Debug.WriteLine(a1.str);
image.Source = a1.image1;
}


No comments:

Post a Comment