아래 그림과 같이 "새 프로젝트"를 만든다.





'솔루션 탐색기'에서 아래 그림과 같이 '새 폴더'를 추가하여 "Views"폴더를 생성하고, "Views"폴더 안에 "새 항목 추가"로 "Silverlight Page"형식으로 "Home.xaml / About.xaml / Board.xaml"파일을 추가하고 아래와 같이 코딩한다.











[Home.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.Home"

           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"

           mc:Ignorable="d"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="Home">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 홈입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 






[About.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.About"

           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"

           mc:Ignorable="d"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="About Page">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 About 페이지입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 








[Board.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.Board"

           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"

           mc:Ignorable="d"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="게시판">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 게시판입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 






[MainPage.xaml]


<UserControl x:Class="RiaNavigationFramework.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"

    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"

 

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*" />

        </Grid.RowDefinitions>

 

        <!-- 메뉴 -->

        <StackPanel Grid.Row="0" Orientation="Horizontal">

            <HyperlinkButton Content="HOME" NavigateUri="/Views/Home.xaml" TargetName="ContentFrame"></HyperlinkButton>

            <HyperlinkButton Content="Board" NavigateUri="Board" TargetName="ContentFrame"></HyperlinkButton>

            <HyperlinkButton Content="About" NavigateUri="/Views/About.xaml" TargetName="ContentFrame"></HyperlinkButton>

        </StackPanel>

 

        <!-- Navigation Framework 사용해서 내용 출력 -->

        <navigation:Frame x:Name="ContentFrame" Source="/Views/Home.xaml" Grid.Row="1">

            <navigation:Frame.UriMapper>

                <uriMapper:UriMapper>

                    <!-- URI 줄여서 표기 : /Views/Board.xaml Board -->

                    <uriMapper:UriMapping Uri="Board" MappedUri="/Views/Board.xaml" />

                </uriMapper:UriMapper>

            </navigation:Frame.UriMapper>

        </navigation:Frame>

    </Grid>

</UserControl>

 

 










'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Silverlight에서 HTML 접근  (0) 2009.12.08
로컬 커넥션  (0) 2009.12.08
Navigation Application  (0) 2009.12.08
다중 페이지 구성  (0) 2009.12.08
OOB(Out Of Browser)  (0) 2009.12.08
Posted by holland14
: