첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ Frame 엘리먼트의 Source 속성을 사용해 컨텐트 XAML 페이지를 로드하는 방법을 보여준다.

TestProject.zip
0.01MB

▶ ContentPage.xaml

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Title="컨텐트 페이지">
    <Grid>
        <Ellipse
            Margin="50"
            Fill="RoyalBlue" />
    </Grid>
</Page>

 

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="Frame 엘리먼트 : Source 속성을 사용해 컨텐트 XAML 페이지 로드하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Frame Name="frame"
        Margin="10"
        BorderThickness="1"
        BorderBrush="Black"
        Source="/CONTENT/ContentPage.xaml" />
</Window>

 

▶ MainWindow.xaml.cs

using System.Windows;

namespace TestProject
{
    /// <summary>
    /// 메인 윈도우
    /// </summary>
    public partial class MainWindow : Window
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
        }

        #endregion
    }
}

 

※ ContentPage.xaml 파일은 [빌드 작업] 항목을 [내용]으로, [출력 디렉터리에 복사] 항목을 [항상 복사] 또는 [새 버전이면 복사]로 설정한다.

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요