■ Frame 클래스 사용하기

------------------------------------------------------------------------------------------------------------------------

 

 

 

 


TestProject.zip


WizardPage0.xaml

 

 

<Page x:Class="TestProject.WizardPage0"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <FlowDocumentScrollViewer Grid.Row="0"

            Margin="10"

            VerticalScrollBarVisibility="Hidden">

            <FlowDocument>

                <Paragraph>컴퓨터 데이트 위저드에 오신 것을 환영합니다.

                이 프로그램은 당신의 꿈의 친구를 찾기 위해 당신의 신상을 조사합니다.</Paragraph>

                <Paragraph>시작하기 위해서, 시작하기 버튼을 클릭해 주시기 바랍니다.</Paragraph>

            </FlowDocument>

        </FlowDocumentScrollViewer>

        <Grid Grid.Row="2">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button

                Grid.Column="1"

                Click="beginButton_Click"

                Margin="10"

                Width="100"

                Height="30"

                Content="시작하기 &gt;" />

        </Grid>

    </Grid>

</Page>

 

 

WizardPage0.xaml.cs

 

 

using System.Windows;

using System.Windows.Controls;

 

namespace TestProject

{

    /// <summary>

    /// 위저드 페이지 0

    /// </summary>

    public partial class WizardPage0 : Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - WizardPage0()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public WizardPage0()

        {

            InitializeComponent();

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

        //////////////////////////////////////////////////////////////////////////////// Event

 

        #region Begin 버튼 클릭시 처리하기 - beginButton_Click(sender, e)

 

        /// <summary>

        /// Begin 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void beginButton_Click(object sender, RoutedEventArgs e)

        {

            if(NavigationService.CanGoForward)

            {

                NavigationService.GoForward();

            }

            else

            {

                Persion persion = new Persion();

 

                WizardPage1 wizardPage1 = new WizardPage1(persion);

 

                NavigationService.Navigate(wizardPage1);

            }

        }

 

        #endregion

    }

}

 

 

WizardPage1.xaml

 

 

<Page x:Class="TestProject.WizardPage1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="50*" />

            <ColumnDefinition Width="50*" />

        </Grid.ColumnDefinitions>

        <StackPanel Grid.ColumnSpan="2"

            Margin="10"

            Orientation="Horizontal">

            <Label>성명</Label>

            <TextBox Name="nameTextBox" Width="200" />

        </StackPanel>

        <GroupBox Name="homeGroupBox" Grid.Row="1" Grid.Column="0"

            Margin="10"

            Header="자택">

            <StackPanel>

                <RadioButton Margin="10" Content="주택" IsChecked="True" />

                <RadioButton Margin="10" Content="아파트" />

                <RadioButton Margin="10" Content="동굴"   />

            </StackPanel>

        </GroupBox>

        <GroupBox Name="genderGroupBox" Grid.Row="1" Grid.Column="1"

            Margin="12"

            Header="성별">

            <StackPanel>

                <RadioButton Margin="10" Content="남성" IsChecked="True" />

                <RadioButton Margin="10" Content="여성" />

                <RadioButton Margin="10" Content="중성" />

            </StackPanel>

        </GroupBox>

        <Grid Grid.Row="3" Grid.ColumnSpan="2">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"

                Margin="10"

                Width="100"

                Height="30"

                Content="&lt; 이전으로"

                Click="previousButton_Click" />

            <Button Grid.Column="2"

                Margin="10"

                Width="100"

                Height="30"

                Content="다음으로 &gt;"

                Click="nextButton_Click" />

        </Grid>

    </Grid>

</Page>

 

 

WizardPage1.xaml.cs

 

 

using System.Windows;

using System.Windows.Controls;

 

namespace TestProject

{

    /// <summary>

    /// 위저드 페이지 1

    /// </summary>

    public partial class WizardPage1 : Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Field

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region Field

 

        /// <summary>

        /// 사람

        /// </summary>

        private Persion persion;

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - WizardPage1(person)

 

        /// <summary>

        /// 생성자

        /// </summary>

        /// <param name="person">사람</param>

        public WizardPage1(Persion person)

        {

            InitializeComponent();

            

            this.persion = person;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Public

        //////////////////////////////////////////////////////////////////////////////// Event

 

        #region Previous 버튼 클릭시 처리하기 - previousButton_Click(sender, e)

 

        /// <summary>

        /// Previous 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void previousButton_Click(object sender, RoutedEventArgs e)

        {

            NavigationService.GoBack();

        }

 

        #endregion

        #region Next 버튼 클릭시 처리하기 - nextButton_Click(sender, e)

 

        /// <summary>

        /// Next 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void nextButton_Click(object sender, RoutedEventArgs e)

        {

            this.persion.Name   = this.nameTextBox.Text;

            this.persion.Home   = Persion.GetCheckedRadioButton(this.homeGroupBox).Content as string;

            this.persion.Gender = Persion.GetCheckedRadioButton(this.genderGroupBox).Content as string;

 

            if(NavigationService.CanGoForward)

            {

                NavigationService.GoForward();

            }

            else

            {

                WizardPage2 wizardPage2 = new WizardPage2(this.persion);

 

                NavigationService.Navigate(wizardPage2);

            }

        }

 

        #endregion

    }

}

 

 

DirectoryPage.xaml

 

 

<PageFunction x:Class="TestProject.DirectoryPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:io="clr-namespace:System.IO;assembly=mscorlib"

    xmlns:tree="clr-namespace:TestProject"

    x:TypeArguments="io:DirectoryInfo"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0"

            HorizontalAlignment="Center"

            FontSize="24"

            FontStyle="Italic">

            컴퓨터 데이트 위저드

        </TextBlock>

        <tree:DirectoryTreeView x:Name="treeView" Grid.Row="1"

            Margin="0 10 0 0 "/>

        <Grid Grid.Row="2">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"

                Margin="10"

                Width="100"

                Height="30"

                IsCancel="True"

                Click="cancelButton_Click">

                취소

            </Button>

            <Button Name="okButton" Grid.Column="2"

                Margin="10"

                Width="100"

                Height="30"

                IsEnabled="False"

                IsDefault="True"

                Click="OkButtonOnClick">

                확인

            </Button>

        </Grid>

    </Grid>

</PageFunction>

 

 

DirectoryPage.xaml.cs

 

 

using System.IO;

using System.Windows;

using System.Windows.Navigation;

 

namespace TestProject

{

    /// <summary>

    /// 디렉토리 페이지

    /// </summary>

    public partial class DirectoryPage : PageFunction<DirectoryInfo>

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - DirectoryPage()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public DirectoryPage()

        {

            InitializeComponent();

 

            this.treeView.SelectedItemChanged += treeView_SelectedItemChanged;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region 트리뷰 선택 항목 변경시 처리하기 - treeView_SelectedItemChanged(sender, e)

 

        /// <summary>

        /// 트리뷰 선택 항목 변경시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

        {

            this.okButton.IsEnabled = (e.NewValue != null);

        }

 

        #endregion

        #region OK 버튼 클릭시 처리하기 - OkButtonOnClick(sender, e)

 

        /// <summary>

        /// OK 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void OkButtonOnClick(object sender, RoutedEventArgs e)

        {

            DirectoryInfo directoryInfo = (this.treeView.SelectedItem as DirectoryTreeViewItem).DirectoryInfo;

 

            OnReturn(new ReturnEventArgs<DirectoryInfo>(directoryInfo));

        }

 

        #endregion

        #region Cancel 버튼 클릭시 처리하기 - cancelButton_Click(sender, e)

 

        /// <summary>

        /// Cancel 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void cancelButton_Click(object sender, RoutedEventArgs e)

        {

            OnReturn(new ReturnEventArgs<DirectoryInfo>());

        }

 

        #endregion

    }

}

 

 

WizardPage2.xaml

 

 

<Page x:Class="TestProject.WizardPage2"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid Margin="10">

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <TextBlock

            Grid.Row="0"

            Margin="0 10 0 0">

            좋아하는 운영 체제 :

        </TextBlock>

        <TextBox Name="favoriteOSTextBox" Grid.Row="1"

            Margin="0 5 0 0"

            Text="마이크로소프트 윈도우즈 10" />

        <TextBlock Grid.Row="2"

            Margin="0 10 0 0">

            좋아하는 디스크 디렉토리 :

        </TextBlock>

        <TextBox Name="favoriteDirectoryTextBox" Grid.Row="3"

            Margin="0 5 0 0"

            Text="C:\" />

        <Button Grid.Row="4"

            Margin="0 5 0 0"

            HorizontalAlignment="Right"

            Width="100"

            Height="30"

            Content="선택하기..."

            Click="browseButton_Click" />

        <Grid Grid.Row="6">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"

                Margin="10"

                Width="100"

                Height="30"

                Content="&lt; 이전으로"

                Click="previousButton_Click" />

            <Button Grid.Column="2"

                Margin="10"

                Width="100"

                Height="30"

                Content="다음으로 &gt;"

                Click="nextButton_Click" />

        </Grid>

    </Grid>

</Page>

 

 

WizardPage2.xaml.cs

 

 

using System.IO;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Navigation;

 

namespace TestProject

{

    /// <summary>

    /// 위저드 페이지 2

    /// </summary>

    public partial class WizardPage2 : Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Field

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region Field

 

        /// <summary>

        /// 사람

        /// </summary>

        private Persion person;

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

        

        #region 생성자 - WizardPage2(persion)

 

        /// <summary>

        /// 생성자

        /// </summary>

        /// <param name="persion">사람</param>

        public WizardPage2(Persion persion)

        {

            InitializeComponent();

 

            this.person = persion;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region Browse 버튼 클릭시 처리하기 - browseButton_Click(sender, e)

 

        /// <summary>

        /// Browse 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void browseButton_Click(object sender, RoutedEventArgs e)

        {

            DirectoryPage directoryPage = new DirectoryPage();

 

            directoryPage.Return += directoryPage_Return;

 

            NavigationService.Navigate(directoryPage);

        }

 

        #endregion

        #region 디렉토리 페이지 반환시 처리하기 - directoryPage_Return(sender, e)

 

        /// <summary>

        /// 디렉토리 페이지 반환시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void directoryPage_Return(object sender, ReturnEventArgs<DirectoryInfo> e)

        {

            if(e.Result != null)

            {

                this.favoriteDirectoryTextBox.Text = e.Result.FullName;

            }

        }

 

        #endregion

        #region Previous 버튼 클릭시 처리하기 - previousButton_Click(sender, e)

        

        /// <summary>

        /// Previous 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void previousButton_Click(object sender, RoutedEventArgs e)

        {

            NavigationService.GoBack();

        }

 

        #endregion

        #region Next 버튼 클릭시 처리하기 - nextButton_Click(sender, e)

 

        /// <summary>

        /// Next 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void nextButton_Click(object sender, RoutedEventArgs e)

        {

            this.person.FavoriteOS = this.favoriteOSTextBox.Text;

            this.person.Directory  = this.favoriteDirectoryTextBox.Text;

 

            if(NavigationService.CanGoForward)

            {

                NavigationService.GoForward();

            }

            else

            {

                WizardPage3 wizardPage3 = new WizardPage3(this.person);

 

                NavigationService.Navigate(wizardPage3);

            }

        }

 

        #endregion

    }

}

 

 

WizardPage3.xaml

 

 

<Page x:Class="TestProject.WizardPage3"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="50*" />

            <ColumnDefinition Width="50*" />

        </Grid.ColumnDefinitions>

        <StackPanel Grid.ColumnSpan="2"

            Margin="10"

            Orientation="Horizontal">

            <Label>어머니 성</Label>

            <TextBox Name="mothersMadenNameTextBox"

                Width="100" />

        </StackPanel>

        <GroupBox Name="petGroupBox" Grid.Row="1" Grid.Column="0"

            Margin="10"

            Header="좋아하는 애완 동물">

            <StackPanel>

                <RadioButton Margin="10" Content="개" IsChecked="True" />

                <RadioButton Margin="10" Content="고양이"    />

                <RadioButton Margin="10" Content="이구아나" />

            </StackPanel>

        </GroupBox>

        <GroupBox Name="incomeGroupBox" Grid.Row="1" Grid.Column="1"

            Margin="10"

            Header="소득 수준">

            <StackPanel>

                <RadioButton Margin="10" Content="부유" IsChecked="True" />

                <RadioButton Margin="10" Content="보통"     />

                <RadioButton Margin="10" Content="프리랜서" />

            </StackPanel>

        </GroupBox>

        <Grid Grid.Row="3" Grid.ColumnSpan="2">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"

                Margin="10"

                Width="100"

                Height="30"

                Content="&lt; 이전으로"

                Click="previousButton_Click" />

            <Button Grid.Column="2"

                Margin="10"

                Width="100"

                Height="30"

                Content="종료하기 &gt;"

                Click="finishButton_Click" />

        </Grid>

    </Grid>

</Page>

 

 

WizardPage3.xaml.cs

 

 

using System;

using System.Windows;

using System.Windows.Controls;

 

namespace TestProject

{

    /// <summary>

    /// 위저드 페이지 3

    /// </summary>

    public partial class WizardPage3: Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Field

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region Field

 

        /// <summary>

        /// 사람

        /// </summary>

        private Persion persion;

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - WizardPage3(person)

 

        /// <summary>

        /// 생성자

        /// </summary>

        /// <param name="person">사람</param>

        public WizardPage3(Persion person)

        {

            InitializeComponent();

 

            this.persion = person;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

        //////////////////////////////////////////////////////////////////////////////// Event

 

        #region Previous 버튼 클릭시 처리하기 - previousButton_Click(sender, e)

 

        /// <summary>

        /// Previous 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void previousButton_Click(object sender, RoutedEventArgs e)

        {

            NavigationService.GoBack();

        }

 

        #endregion

        #region Finish 버튼 클릭시 처리하기 - finishButton_Click(sender, e)

 

        /// <summary>

        /// Finish 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void finishButton_Click(object sender, RoutedEventArgs e)

        {

            this.persion.MothersMaidenName = this.mothersMadenNameTextBox.Text;

            this.persion.Pet               = Persion.GetCheckedRadioButton(this.petGroupBox).Content as string;

            this.persion.Income            = Persion.GetCheckedRadioButton(this.incomeGroupBox).Content as string;

 

            WizardPage4 wizardPage4 = new WizardPage4(this.persion);

 

            NavigationService.Navigate(wizardPage4);

        }

 

        #endregion

    }

}

 

 

WizardPage4.xaml

 

 

<Page x:Class="TestProject.WizardPage4"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Padding="10">

            <LineBreak />

            <Run Text="성명 :" />

            <Run Name="nameRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="자택 :" />

            <Run Name="homeRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="성별 :" />

            <Run Name="genderRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="좋아하는 운영 체제 :" />

            <Run Name="favoriteOSRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="좋아하는 디렉토리 :" />

            <Run Name="favoriteDirectoryRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="어머니 성 :" />

            <Run Name="mothersMaidenNameRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="좋아하는 애완 동물 :" />

            <Run Name="petRun" />

            <LineBreak />

            <LineBreak />

            <Run Text="소득 수준 :" />

            <Run Name="incomeRun" />

        </TextBlock>

        <Grid Grid.Row="2">

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"    />

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"

                Margin="10"

                Width="100"

                Height="30"

                Content="&lt; 이전으로"

                Click="previousButton_Click" />

            <Button Grid.Column="2"

                Margin="10"

                Width="100"

                Height="30"

                Content="제출하기"

                Click="submitButton_Click" />

        </Grid>

    </Grid>

</Page>

 

 

WizardPage4.xaml.cs

 

 

using System.Windows;

using System.Windows.Controls;

 

namespace TestProject

{

    /// <summary>

    /// 위저드 페이지 4

    /// </summary>

    public partial class WizardPage4: Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - WizardPage4(persion)

 

        /// <summary>

        /// 생성자

        /// </summary>

        /// <param name="persion">사람</param>

        public WizardPage4(Persion persion)

        {

            InitializeComponent();

 

            this.nameRun.Text              = persion.Name;

            this.homeRun.Text              = persion.Home;

            this.genderRun.Text            = persion.Gender;

            this.favoriteOSRun.Text        = persion.FavoriteOS;

            this.favoriteDirectoryRun.Text = persion.Directory;

            this.mothersMaidenNameRun.Text = persion.MothersMaidenName;

            this.petRun.Text               = persion.Pet;

            this.incomeRun.Text            = persion.Income;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

        //////////////////////////////////////////////////////////////////////////////// Event

 

        #region Previous 버튼 클릭시 처리하기 - previousButton_Click(sender, e)

 

        /// <summary>

        /// Previous 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void previousButton_Click(object sender, RoutedEventArgs e)

        {

            NavigationService.GoBack();

        }

 

        #endregion

        #region Submit 버튼 클릭시 처리하기 - submitButton_Click(sender, e)

 

        /// <summary>

        /// Submit 버튼 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void submitButton_Click(object sender, RoutedEventArgs e)

        {

            MessageBox.Show

            (

                "감사합니다!\n\n4-6개월 내 메일로 연락이 갈 것입니다.",

                Application.Current.MainWindow.Title,

                MessageBoxButton.OK,

                MessageBoxImage.Exclamation

            );

 

            Application.Current.Shutdown();

        }

 

        #endregion

    }

}

 

 

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"

    WindowStartupLocation="CenterScreen"

    Width="600"

    Height="450"

    ResizeMode="NoResize"

    Title="Frame 클래스 사용하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*"    />

        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0"

            Margin="12"

            HorizontalAlignment="Center"

            FontSize="24"

            FontWeight="Bold"

            FontStyle="Italic">

            컴퓨터 데이트 위저드

        </TextBlock>

        <Frame Name="frame" Grid.Row="1"

            NavigationUIVisibility="Hidden"

            Padding="6" />

    </Grid>

</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();

 

            this.frame.Navigate(new WizardPage0());

        }

 

        #endregion

    }

}

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요