1

I am trying to work with Modern UI, namely Modern Tab control.

I have created a LinkList of Pages(UserControls) and is popuating my tabcontrol with these, since I will be fetching data from a database, and thus it is not possible for me to know how many links the user will be presented with.

My problem is, binding an event to the Link, and loading content according to the selected Link.

I have tried to use SelectedSourceChanged="{Binding SelectedKalenderChanged}", but this is not possible. I have then tried to call the event behind-code, however the event only fires off once, and I get no updates when the user selects another link.

Here is the method behind-code;

private void KalenderController_OnSelectedSourceChanged(object sender, SourceEventArgs e)

There is no e.Handled possibility.

Anyone have a suggestion on how I can raise a propertychanged event when the user selects another link?

Thank you in advance for any help/suggestions

agold
  • 6,140
  • 9
  • 38
  • 54

1 Answers1

0

I found out what i was doing wrong, i was naming my page uri on list creation with the same name.

By doing this;

   public MainViewModel()
    {
       LinkList = new LinkCollection();
       KalenderList = new ObservableCollection<Kalender>();
       KalenderList = DataHandler.HentKalendere();
        foreach (var kalender in KalenderList)
        {
            LinkList.Add(new Link
            {
                DisplayName = kalender.Navn,
                Source = new Uri("/Pages/UgePage.xaml#"+kalender.Navn, UriKind.Relative)
            });
        }
        _selectedKalender = LinkList[0].Source;

}

i am now able to detect which link was selected.