This project is read-only.

navigating through pages and links ( code )

Nov 9, 2013 at 2:05 PM
I have the following code triggered by a button click :
MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);

var linkTestGroup1 = new LinkGroup { DisplayName = "Home", GroupName = "Home" };
var link1 = new Link { DisplayName = "login", Source = new Uri("/Pages/Login.xaml", UriKind.Relative) };

Whats it does is it clears all groups and links in my main window and it adds a new Home group as well as a login link.The problem is that I want the login link to be selected ,because what happens now is that I get blank content and I have to click the login link to display its content.

To summarize I want to be able to navigate to a selected page or link ( for example group 2 link 3) or at least solve the problem above.
Nov 13, 2013 at 5:48 PM
Edited Nov 13, 2013 at 5:49 PM
You have to add the content source to your mainWindow.
mainWindow.ContentSource = new Uri("/Pages/Login.xaml", UriKind.Relative);
With this code your Page should be set to the login page.