Passing Data in Tabview

Apr 1, 2013 at 5:45 PM
Hello there,

Thank you for this beautiful framework. I am new to C# and WPF and yet I was able to create a beautiful UI.

My problem is how to pass data within your tabs. I have a ListBox on the left of my page and a ModernTab to the right of it. Now I want to pass data out of the selected Item from the listbox to the different tabs. Since those are only links with no further fields I am kind of stuck.

I am very aware that this is probably due to my limited experience with c# but it would be very kind if someone could help me anyway.

KIind regards,
Urm3l
Coordinator
Apr 1, 2013 at 6:15 PM
Edited Apr 1, 2013 at 6:17 PM
Good to hear mui is working well for you. Passing data using links is limited but possible by adding a fragment to your Link.Source. You can access the Fragment by implementing the IContent interface and handle the OnFragmentNavigation method.

Assume your link source is /Pages/MyPage.xaml#foo, where foo is the fragment. Then in your MyPage.xaml.cs you need to implement IContent like so:
public partial class MyPage : UserControl, IContent
{
  public void OnFragmentNavigation(FragmentNavigationEventArgs e)
  {
    if (e.Fragment == "foo") {
      // do something
    }
  }

  public void OnNavigatedFrom(NavigationEventArgs e)
  {
  }

  public void OnNavigatedTo(NavigationEventArgs e)
  {
  }

  public void OnNavigatingFrom(NavigatingCancelEventArgs e)
  {
  }
}
Currently only string data in the form of uri fragments can be passed around. You can use it as identifier for your actions.
Apr 2, 2013 at 7:40 AM
If kozw suggestions are not enough, search the web for the mediator pattern or event broker / event aggregator.
Apr 2, 2013 at 9:14 AM
Thank you. I will look into it. I guess that solves my problem.