2

I'm trying to develop a small program in ModernUI. I have a small database with personal infos (for now its just a class where I have a testPerson). I want to add a new link with a source in c# code.

Adding the Link and Source is not a big problem. I did it here for example:

PersonenDatenDummy pers = new PersonenDatenDummy();
FirstFloor.ModernUI.Presentation.Link link = new FirstFloor.ModernUI.Presentation.Link();
link.DisplayName = pers.getVorname() + " " + pers.getNachname();
Person person = new Person(pers.getVorname(), pers.getNachname());
link.Source = new Uri("/Pages/Person.xaml",UriKind.Relative);
this.ModernTabLinks.Links.Add(link);

In this case the "Person person" is an object which contains all the Data (for now just the name). person.xaml is there to show the data contained in person. Now this works fine when there is just one person. But by adding another Person all person show the same data.

My Idea was to get an uri from Person person, to add it to the link.Source.

I found another thread with a similar question but OP figured out what to do and was never seen again. Just say if you guys need more information. Its my first time posting here after many many useful answers I got from here, I hope I'm doing it right.

Thanks in advance.

Bernd Linde
  • 2,098
  • 2
  • 16
  • 22
Kuchen
  • 108
  • 7

1 Answers1

0

Are you familiar with MVVM? You should set the DataContext for Person.xaml to a ViewModel. This ViewModel should encapsulate whatever information you need about a Person, and possibly reference the Person object itself. The Link data structure is for navigation only; it is not intended to store additional data.

Mark Richman
  • 28,948
  • 25
  • 99
  • 159