This project is read-only.

SelectedIndex for ModernTab Links

Mar 19, 2013 at 8:45 PM
Is it possible to get and set the SelectedIndex of a link in a ModernTab control?

I would like to add a link to the list manually, which I am able to do. But I want to add it to the end of the list, and then select that link.

This works if I load the page, and click a button to add the link, but this does not work if I load the page, navigate to a link or two that are currently in the list, and then add one. Adding it works fine, but not setting the selectedindex of the control.
Mar 19, 2013 at 10:12 PM
You can select a link by setting the SelectedSource property. Just make sure the Link.Source values are unique. Something like this works;
// create link
var link = new Link {
  DisplayName = "my link",
  Source = new Uri("/mylinkuri", UriKind.Relative)

// add link

// and select the added link by specifying its source
tab.SelectedSource = link.Source
Mar 20, 2013 at 1:31 AM
Thanks. I was doing that and figured something was wrong when it was not working. I'm using MVVM and my issue was related to my binding method. I was not using two way binding to set the source. All is good now, thank you for your help.