How can i set ContentSource Dynamically?

May 17, 2014 at 6:17 PM
Edited May 17, 2014 at 6:24 PM
Hello,
I want to set ContentSource Dynamically, i tried the following code

XAML:
<mui:ModernWindow x:Class="ModernUIApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mui="http://firstfloorsoftware.com/ModernUI"
        xmlns:MyUserControls="clr-namespace:ModernUIApp1.Pages"
        Title="test" IsTitleVisible="True" x:Name="test">
</mui:ModernWindow>
C#:
try
            {
                Uri t = new Uri("//Pages//Settings.xaml");
                test.ContentSource = t;
            }
            catch (Exception ex)
            { }
Im getting Navigation Failed, Cannot use absolute URI.
Please help
May 17, 2014 at 7:10 PM
ok. this worked for me
var wnd = Application.Current.MainWindow as ModernWindow;

           
wnd.ContentSource = new Uri("/Pages/Settings.xaml", UriKind.Relative);