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

TestProject.zip
다운로드

▶ 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"
    xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar"
    Width="800"
    Height="600"
    Title="그룹/항목 모양을 커스텀 처리하기 위해 스타일 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <Style x:Key="CommonGroupStyleKey">
            <Setter Property="dxn:NavBarViewBase.LayoutSettings" Value="{dxn:NavBarLayoutSettings TextHorizontalAlignment=Right}" />
            <Setter Property="Control.Foreground"                Value="Yellow"                                                   />
            <Setter Property="Control.FontWeight"                Value="Bold"                                                     />
        </Style>
        <Style x:Key="CommonItemStyleKey">
            <Setter Property="dxn:NavBarViewBase.LayoutSettings" Value="{dxn:NavBarLayoutSettings TextHorizontalAlignment=Right}" />
            <Setter Property="Control.Foreground"                Value="Blue"                                                     />
        </Style>
        <Style x:Key="IndividualGroupStyleKey">
            <Setter Property="dxn:NavBarViewBase.LayoutSettings" Value="{dxn:NavBarLayoutSettings TextHorizontalAlignment=Center}" />
            <Setter Property="Control.Foreground"                Value="LightBlue"                                                 />
            <Setter Property="Control.FontWeight"                Value="Bold"                                                      />
            <Setter Property="Control.FontStyle"                 Value="Italic"                                                    />
        </Style>
        <Style x:Key="IndividualGroupItemStyleKey">
            <Setter Property="dxn:NavBarViewBase.LayoutSettings" Value="{dxn:NavBarLayoutSettings TextHorizontalAlignment=Center}" />
            <Setter Property="Control.Foreground"                Value="Gray"                                                      />
            <Setter Property="Control.FontStyle"                 Value="Italic"                                                    />
        </Style>
        <Style x:Key="IndividualItemStyleKey">
            <Setter Property="dxn:NavBarViewBase.LayoutSettings" Value="{dxn:NavBarLayoutSettings TextHorizontalAlignment=Left}" />
            <Setter Property="Control.Foreground"                Value="Black"                                                   />
            <Setter Property="Control.FontWeight"                Value="Bold"                                                    />
        </Style>
    </Window.Resources>
    <DockPanel Margin="10">
        <dxn:NavBarControl x:Name="navBarControl">
            <dxn:NavBarControl.View>
                <dxn:ExplorerBarView
                    GroupVisualStyle="{StaticResource CommonGroupStyleKey}"
                    ItemVisualStyle="{StaticResource CommonItemStyleKey}" />
            </dxn:NavBarControl.View>
            <dxn:NavBarControl.Groups>
                <dxn:NavBarGroup Header="Group1">
                    <dxn:NavBarItem>Item1</dxn:NavBarItem>
                </dxn:NavBarGroup>
                <dxn:NavBarGroup Header="Group2">
                    <dxn:NavBarItem>Item1</dxn:NavBarItem>
                    <dxn:NavBarItem>Item2</dxn:NavBarItem>
                </dxn:NavBarGroup>
                <dxn:NavBarGroup
                    VisualStyle="{StaticResource IndividualGroupStyleKey}"
                    ItemVisualStyle="{StaticResource IndividualGroupItemStyleKey}"
                    Header="Group3">
                    <dxn:NavBarItem>Item1</dxn:NavBarItem>
                    <dxn:NavBarItem>Item2</dxn:NavBarItem>
                    <dxn:NavBarItem
                        VisualStyle="{StaticResource IndividualItemStyleKey}">
                        Item3
                    </dxn:NavBarItem>
                </dxn:NavBarGroup>
            </dxn:NavBarControl.Groups>
        </dxn:NavBarControl>
    </DockPanel>
</Window>

 

728x90

 

▶ 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
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요