첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형

TestProject.zip
0.03MB

▶ SamplePage1.xaml

<Page x:Class="TestProject.SamplePage1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ScrollViewer>
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <Grid.Resources>
                <x:Double x:Key="TileHeightKey">150</x:Double>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*"    />
                <ColumnDefinition Width="*"    />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"    />
            </Grid.RowDefinitions>
            <Grid Grid.Row="1" Grid.Column="1" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="DarkGray"  />
            <Grid Grid.Row="1" Grid.Column="2" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="LightGray" />
            <Grid Grid.Row="2" Grid.Column="1" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="LightGray" />
            <Grid Grid.Row="2" Grid.Column="2" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="DarkGray"  />
            <Grid Name="sourceGrid" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2"
                Margin="5"
                MinWidth="250"
                MinHeight="{StaticResource TileHeightKey}"
                Background="{ThemeResource SystemAccentColor}" />
            <Grid Grid.Row="3" Grid.ColumnSpan="3"
                Margin="5 10">
                <TextBlock
                    TextWrapping="WrapWholeWords"
                    Style="{ThemeResource BodyTextBlockStyle}">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </TextBlock>
            </Grid>
        </Grid>
    </ScrollViewer>
</Page>

 

728x90

 

▶ SamplePage1.xaml.cs

using Windows.Foundation.Metadata;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

namespace TestProject
{
    /// <summary>
    /// 샘플 페이지 1
    /// </summary>
    public sealed partial class SamplePage1 : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - SamplePage1()

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

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 연결 애니메이션 준비하기 - PrepareConnectedAnimation(configuration)

        /// <summary>
        /// 연결 애니메이션 준비하기
        /// </summary>
        /// <param name="configuration">연결 애니메이션 구성</param>
        public void PrepareConnectedAnimation(ConnectedAnimationConfiguration configuration)
        {
            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", this.sourceGrid);

            if(configuration != null && ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                animation.Configuration = configuration;
            }
        }

        #endregion

        ////////////////////////////////////////////////////////////////////////////////////////// Protected

        #region 탐색되는 경우 처리하기 - OnNavigatedTo(e)

        /// <summary>
        /// 탐색되는 경우 처리하기
        /// </summary>
        /// <param name="e">이벤트 인자</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("BackwardAnimation");

            if(animation != null)
            {
                animation.TryStart(this.sourceGrid);
            }
        }

        #endregion
    }
}

 

300x250

 

▶ SamplePage2.xaml

<Page x:Class="TestProject.SamplePage2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ScrollViewer>
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <Grid.Resources>
                <x:Double x:Key="TileHeightKey">150</x:Double>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*"    />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid Name="targetGrid" Grid.Row="1" Grid.Column="0"
                VerticalAlignment="Top"
                Margin="10"
                Width="150"
                MinHeight="{StaticResource TileHeightKey}"
                Height="200"
                Background="{ThemeResource SystemAccentColor}" />
            <StackPanel Name="contentStackPanel" Grid.Row="1" Grid.Column="1"
                Margin="10"
                MinHeight="200">
                <TextBlock
                    Style="{ThemeResource TitleTextBlockStyle}"
                    Margin="0 0 0 10"
                    TextWrapping="WrapWholeWords"
                    Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit" />
                <TextBlock TextWrapping="WrapWholeWords">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                 </TextBlock>
            </StackPanel>
        </Grid>
    </ScrollViewer>
</Page>

 

▶ SamplePage2.xaml.cs

using Windows.Foundation.Metadata;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

namespace TestProject
{
    /// <summary>
    /// 샘플 페이지 2
    /// </summary>
    public sealed partial class SamplePage2 : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - SamplePage2()

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

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 연결 애니메이션 준비하기 - PrepareConnectedAnimation(configuration)

        /// <summary>
        /// 연결 애니메이션 준비하기
        /// </summary>
        /// <param name="configuration">연결 애니메이션 구성</param>
        public void PrepareConnectedAnimation(ConnectedAnimationConfiguration configuration)
        {
            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("BackwardAnimation", this.targetGrid);

            if(configuration != null && ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                animation.Configuration = configuration;
            }
        }

        #endregion

        ////////////////////////////////////////////////////////////////////////////////////////// Protected

        #region 탐색 되는 경우 처리하기 - OnNavigatedTo(e)

        /// <summary>
        /// 탐색 되는 경우 처리하기
        /// </summary>
        /// <param name="e">이벤트 인자</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("ForwardAnimation");

            if(animation != null)
            {
                SetContentStackPanelTransitionCollection();

                animation.TryStart(this.targetGrid);
            }
        }

        #endregion

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

        #region 컨텐트 스택 패널 전이 컬렉션 설정하기 - SetContentStackPanelTransitionCollection()

        /// <summary>
        /// 컨텐트 스택 패널 전이 컬렉션 설정하기
        /// </summary>
        private void SetContentStackPanelTransitionCollection()
        {
            this.contentStackPanel.Transitions = new TransitionCollection { new EntranceThemeTransition() };
        }

        #endregion
    }
}

 

▶ SamplePage3.xaml

<Page x:Class="TestProject.SamplePage3"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ScrollViewer>
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <Grid.Resources>
                <x:Double x:Key="TileHeightKey">150</x:Double>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="*"  />
                <ColumnDefinition Width="*"  />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"    />
            </Grid.RowDefinitions>
            <Grid Grid.Row="1" Grid.Column="0" Grid.RowSpan="2"
                Margin="5"
                MinHeight="{StaticResource TileHeightKey}"
                Background="LightGray" />
            <Grid Grid.Row="1" Grid.Column="1" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="DarkGray"  />
            <Grid Grid.Row="2" Grid.Column="1" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="Gray"      />
            <Grid Grid.Row="1" Grid.Column="2" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="LightGray" />
            <Grid Grid.Row="2" Grid.Column="2" Margin="5" MinHeight="{StaticResource TileHeightKey}" Background="DarkGray"  />
            <Grid Grid.Row="3" Grid.ColumnSpan="3"
                Margin="5">
                <TextBlock
                    TextWrapping="WrapWholeWords">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </TextBlock>
            </Grid>
        </Grid>
    </ScrollViewer>
</Page>

 

▶ SamplePage3.xaml.cs

using Windows.UI.Xaml.Controls;

namespace TestProject
{
    /// <summary>
    /// 샘플 페이지 3
    /// </summary>
    public sealed partial class SamplePage3 : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - SamplePage3()

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

        #endregion
    }
}

 

▶ SampleSettingPage.xaml

<Page x:Class="TestProject.SampleSettingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock
            Style="{StaticResource TitleTextBlockStyle}"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Text="샘플 설정 페이지" />
    </Grid>
</Page>

 

▶ SampleSettingPage.xaml.cs

using Windows.UI.Xaml.Controls;

namespace TestProject
{
    /// <summary>
    /// 샘플 설정 페이지
    /// </summary>
    public sealed partial class SampleSettingPage : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - SampleSettingPage()

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

        #endregion
    }
}

 

▶ MainPage.xaml

<Page x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <Grid Margin="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"    />
                <ColumnDefinition Width="10"   />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <muxc:NavigationView Name="navigationView"
                ExpandedModeThresholdWidth="500"
                IsTabStop="False"
                PaneDisplayMode="Left"
                Header="{Binding ElementName=headerTextBox, Path=Text, Mode=TwoWay}"
                PaneTitle="{Binding ElementName=paneTextBox, Path=Text, Mode=TwoWay}"
                SelectionChanged="navigationView_SelectionChanged">
                <muxc:NavigationView.MenuItems>
                    <muxc:NavigationViewItem
                        Tag="SamplePage1"
                        Content="메뉴 항목 1">
                        <muxc:NavigationViewItem.Icon>
                            <SymbolIcon Symbol="Play" />
                        </muxc:NavigationViewItem.Icon>
                    </muxc:NavigationViewItem>
                    <muxc:NavigationViewItemHeader Content="액션" />
                    <muxc:NavigationViewItem Name="navigationViewItem2"
                        Content="메뉴 항목 2"
                        Tag="SamplePage2"
                        SelectsOnInvoked="True">
                        <muxc:NavigationViewItem.Icon>
                            <SymbolIcon Symbol="Save" />
                        </muxc:NavigationViewItem.Icon>
                    </muxc:NavigationViewItem>
                    <muxc:NavigationViewItem
                        Content="메뉴 항목 3"
                        Tag="SamplePage3">
                        <muxc:NavigationViewItem.Icon>
                            <SymbolIcon Symbol="Refresh" />
                        </muxc:NavigationViewItem.Icon>
                    </muxc:NavigationViewItem>
                </muxc:NavigationView.MenuItems>
                <muxc:NavigationView.PaneCustomContent>
                    <HyperlinkButton Name="moreInformationHyperlinkButton"
                        Content="추가 정보"
                        Margin="10 0"
                        Visibility="Collapsed" />
                </muxc:NavigationView.PaneCustomContent>
                <muxc:NavigationView.AutoSuggestBox>
                    <AutoSuggestBox QueryIcon="Find" />
                </muxc:NavigationView.AutoSuggestBox>
                <muxc:NavigationView.PaneFooter>
                    <StackPanel Name="paneFooterStackPanel"
                        Orientation="Vertical"
                        Visibility="Collapsed">
                        <muxc:NavigationViewItem Icon="Download" />
                        <muxc:NavigationViewItem Icon="Favorite" />
                    </StackPanel>
                </muxc:NavigationView.PaneFooter>
                <Frame Name="frame" />
            </muxc:NavigationView>
            <StackPanel Grid.Column="2"
                Spacing="10">
                <CheckBox
                    Content="설정 항목 표시"
                    IsChecked="True"
                    Click="isSettingsVisibleCheckBox_Click" />
                <CheckBox
                    Content="뒤로가기 버튼 표시"
                    IsChecked="True"
                    Click="backButtonVisibleCheckBox_Click" />
                <CheckBox
                    Content="뒤로가기 버튼 이용 가능"
                    IsChecked="False"
                    Click="backButtonEnabledCheckBox_Click" />
                <CheckBox Name="autoSuggestCheck"
                    Content="자동 제안 박스 표시"
                    IsChecked="True"
                    Click="autoSuggestBoxCheckBox_Click" />
                <TextBlock Text="헤더 :" />
                <TextBox Name="headerTextBox"
                    Text="헤더" />
                <CheckBox Name="headerCheck"
                    Content="항상 헤더 표시 여부"
                    IsChecked="True"
                    Click="alwaysShowHeaderCheckBox_Click" />
                <TextBlock Text="창 제목 :" />
                <TextBox Name="paneTextBox"
                    Text="창 제목" />
                <CheckBox
                    Content="창 커스텀 컨텐트 표시"
                    IsChecked="False"
                    Click="showPaneCustomContentCheckBox_Click" />
                <CheckBox Name="paneFooterCheck"
                    Content="창 꼬리말 표시"
                    IsChecked="False"
                    Click="showPaneFooterCheckBox_Click" />
                <TextBlock Text="창 위치 :" />
                <RadioButton Name="nvSampleLeft"
                    Content="왼쪽"
                    IsChecked="True"
                    Checked="leftPanePositionCheckBox_Checked" />
                <RadioButton Name="nvSampleTop"
                    Content="위쪽"
                    Checked="topPanePositionRadioButton_Checked" />
                <CheckBox Name="sffCheck"
                    Content="포커스 변경시 선택 변경"
                    IsChecked="False"
                    Click="selectionFollowsFocusCheckBox_Click" />
                <CheckBox
                    Content="메뉴 항목 2 선택 금지"
                    IsChecked="False"
                    Click="suppressMenuItem2SelectionCheckBox_Click" />
            </StackPanel>
        </Grid>
    </Grid>
</Page>

 

▶ MainPage.xaml.cs

using System;
using Windows.Foundation;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace TestProject
{
    /// <summary>
    /// 메인 페이지
    /// </summary>
    public sealed partial class MainPage : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainPage()

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

            #region 윈도우 크기를 설정한다.

            double width  = 800d;
            double height = 600d;

            double dpi = (double)DisplayInformation.GetForCurrentView().LogicalDpi;

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            Size windowSize = new Size(width * 96d / dpi, height * 96d / dpi);

            ApplicationView.PreferredLaunchViewSize = windowSize;

            Window.Current.Activate();

            ApplicationView.GetForCurrentView().TryResizeView(windowSize);

            #endregion
            #region 윈도우 제목을 설정한다.

            ApplicationView.GetForCurrentView().Title = "NavigationView 엘리먼트 사용하기";

            #endregion
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 네비게이션 뷰 선택 변경시 처리하기 - navigationView_SelectionChanged(sender, e)

        /// <summary>
        /// 네비게이션 뷰 선택 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void navigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs e)
        {
            if(e.IsSettingsSelected)
            {
                this.frame.Navigate(typeof(SampleSettingPage));
            }
            else
            {
                Microsoft.UI.Xaml.Controls.NavigationViewItem item = e.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;

                if(item != null)
                {
                    string itemTag = item.Tag.ToString();

                    sender.Header = "샘플 페이지 " + itemTag.Substring(itemTag.Length - 1);

                    string pageName = "TestProject." + itemTag;

                    Type pageType = Type.GetType(pageName);

                    this.frame.Navigate(pageType);
                }
            }
        }

        #endregion
        #region 설정 표시 여부 체크 박스 클릭시 처리하기 - isSettingsVisibleCheckBox_Click(sender, e)

        /// <summary>
        /// 설정 표시 여부 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void isSettingsVisibleCheckBox_Click(object sender, RoutedEventArgs e)
        {
            this.navigationView.IsSettingsVisible = (sender as CheckBox).IsChecked == true ? true : false;
        }

        #endregion
        #region 뒤로가기 버튼 표시 체크 박스 클릭시 처리하기 - backButtonVisibleCheckBox_Click(sender, e)

        /// <summary>
        /// 뒤로가기 버튼 표시 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void backButtonVisibleCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            if(checkBox.IsChecked == true)
            {
                this.navigationView.IsBackButtonVisible = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Visible;
            }
            else
            {
                this.navigationView.IsBackButtonVisible = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed;
            }
        }

        #endregion
        #region 뒤로가기 버튼 이용 가능 체크 박스 클릭시 처리하기 - backButtonEnabledCheckBox_Click(sender, e)

        /// <summary>
        /// 뒤로가기 버튼 이용 가능 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void backButtonEnabledCheckBox_Click(object sender, RoutedEventArgs e)
        {
            this.navigationView.IsBackEnabled = (sender as CheckBox).IsChecked == true ? true : false;
        }

        #endregion
        #region 자동 제안 박스 체크 박스 클릭시 처리하기 - autoSuggestBoxCheckBox_Click(sender, e)

        /// <summary>
        /// 자동 제안 박스 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void autoSuggestBoxCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            if(checkBox.IsChecked == true)
            {
                AutoSuggestBox autoSuggestBox = new AutoSuggestBox()
                {
                    QueryIcon = new SymbolIcon(Symbol.Find)
                };

                this.navigationView.AutoSuggestBox = autoSuggestBox;
            }
            else
            {
                this.navigationView.AutoSuggestBox = null;
            }
        }

        #endregion
        #region 헤더 항상 표시 체크 박스 클릭시 처리하기 - alwaysShowHeaderCheckBox_Click(sender, e)

        /// <summary>
        /// 헤더 항상 표시 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void alwaysShowHeaderCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            this.navigationView.AlwaysShowHeader = checkBox.IsChecked == true ? true : false;
        }

        #endregion
        #region 창 커스텀 컨텐트 표시 체크 박스 클릭시 처리하기 - showPaneCustomContentCheckBox_Click(sender, e)

        /// <summary>
        /// 창 커스텀 컨텐트 표시 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void showPaneCustomContentCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            if(checkBox.IsChecked == true)
            {
                this.moreInformationHyperlinkButton.Visibility = Visibility.Visible;
            }
            else
            {
                this.moreInformationHyperlinkButton.Visibility = Visibility.Collapsed;
            }
        }

        #endregion
        #region 창 꼬리말 표시 체크 박스 클릭시 처리하기 - showPaneFooterCheckBox_Click(sender, e)

        /// <summary>
        /// 창 꼬리말 표시 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void showPaneFooterCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            if(checkBox.IsChecked == true)
            {
                this.paneFooterStackPanel.Visibility = Visibility.Visible;
            }
            else
            {
                this.paneFooterStackPanel.Visibility = Visibility.Collapsed;
            }
        }

        #endregion
        #region 왼쪽 창 위치 라디오 버튼 체크시 처리하기 - leftPanePositionCheckBox_Checked(sender, e)

        /// <summary>
        /// 왼쪽 창 위치 라디오 버튼 체크시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void leftPanePositionCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            this.navigationView.PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Left;
            this.navigationView.IsPaneOpen      = true;

            this.paneFooterStackPanel.Orientation = Orientation.Vertical;
        }

        #endregion
        #region 위쪽 창 위치 라디오 버튼 체크시 처리하기 - topPanePositionRadioButton_Checked(sender, e)

        /// <summary>
        /// 위쪽 창 위치 라디오 버튼 체크시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void topPanePositionRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            this.navigationView.PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
            this.navigationView.IsPaneOpen      = false;

            this.paneFooterStackPanel.Orientation = Orientation.Horizontal;
        }

        #endregion
        #region 포커스 변경시 선택 변경 체크 박스 클릭시 처리하기 - selectionFollowsFocusCheckBox_Click(sender, e)

        /// <summary>
        /// 포커스 변경시 선택 변경 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void selectionFollowsFocusCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            if(checkBox.IsChecked == true)
            {
                this.navigationView.SelectionFollowsFocus = Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus.Enabled;
            }
            else
            {
                this.navigationView.SelectionFollowsFocus = Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus.Disabled;
            }
        }

        #endregion
        #region 메뉴 항목 2 선택 금지 체크 박스 클릭시 처리하기 - suppressMenuItem2SelectionCheckBox_Click(sender, e)

        /// <summary>
        /// 메뉴 항목 2 선택 금지 체크 박스 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void suppressMenuItem2SelectionCheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            this.navigationViewItem2.SelectsOnInvoked = (checkBox.IsChecked == true) ? false : true;
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by 사용자 icodebroker

댓글을 달아 주세요