1

I have a xaml Page with class parameters:

public partial class result : Page
{
    public result(string inpH1, string inpH2, string inpH3, string inpText)
    {
        InitializeComponent();
        ....
     }

I want to add the page into a stackpanel:

Frame neu = new Frame();
neu.Source = new System.Uri("result.xaml", UriKind.RelativeOrAbsolute);
stackpanel1.Children.Add(neu);

My question is, how can I write my parameter in Uri?

My code works without parameters perfect, but I have no idea how to call it with parameters

Bizhan
  • 16,157
  • 9
  • 63
  • 101
PeterN
  • 217
  • 1
  • 4
  • 15

1 Answers1

3

You cannot set the Source to a Uri to create an instance of your result class but you can set the Content property to an instance that you create yourself using the custom constructor:

Frame neu = new Frame();
neu.Content = new result("a", "b", "c", "d");
stackpanel1.Children.Add(neu);
mm8
  • 163,881
  • 10
  • 57
  • 88