Pooria Khodaveissi
Pooria Khodaveissi

Reputation: 395

Passing Parameters from one XAML page to another

I have a Tile Layout Control with of course Tiles in it which I use to let user navigate through pages, I simply want to pass some parameters like strings or integers between my pages... How to do that?

Upvotes: 0

Views: 1348

Answers (2)

Malgaur
Malgaur

Reputation: 1850

Generally you will have some sort of manager controlling your windows. That manager would handle passing the data between the windows. The windows generally should not know anything about each other.

Simplistic Example

class Manager
{
   ...
   void DoSomething()
   {
      ViewModelA vma = new ViewModelA();
      WindowA wa = new WindowA();
      wa.DataContext = vma;
      wa.ShowDialog();
      ViewModelB vmb = new ViewModelB();
      vmb.SharedData = vma.SharedData;
      WindowB wb = new WindowB();
      wb.DataContext = vmb;
      wb.ShowDialog();
   }
   ...
}

Upvotes: 1

COLD TOLD
COLD TOLD

Reputation: 13579

you can try this approach or just by passing data between classes

http://msmvps.com/blogs/siva/archive/2007/05/11/storing-application-wide-data-the-wpf-way.aspx

 Application.Current.Properties["youvalueindex"];

Upvotes: 1

Related Questions