Social Icons

Tuesday, September 18, 2012

How to navigate the frame to another view in another silver-light project under same solution

You can navigate from one view to another view in different silver-light project under same solution by using the following code.



private void button1_Click(object sender, RoutedEventArgs 
{



this.frame1.Navigate(new Uri("/MyNewSDXProject;component/TestViews/MyTestUC.xaml", UriKind.Relative));
}


Xaml will look like this:


<UserControl x:Class="SilverlighProjectTestingApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="48,47,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        <sdk:Frame  Height="175" HorizontalAlignment="Left" Margin="48,92,0,0" Name="frame1" VerticalAlignment="Top" Width="293" BorderBrush="#006C1313" NavigationFailed="frame1_NavigationFailed" />
    </Grid>
</UserControl>


No comments:

Post a Comment

 

Sample text

Sample Text