첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
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:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    Width="800"
    Height="600"
    Title="BAR 항목 생성하고 카테고리와 결합하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <dxb:BarManager x:Name="barManager">
            <dxb:BarManager.Categories>
                <dxb:BarManagerCategory Name="Format Category" />
            </dxb:BarManager.Categories>
            <dxb:BarManager.Items>
                <dxb:BarCheckItem x:Name="boldBarCheckItem"
                    CategoryName="Format Category"
                    Glyph="pack://application:,,,/Image/bold16x16.png"
                    LargeGlyph="pack://application:,,,/Image/bold32x32.png"
                    GlyphSize="Small"
                    Content="Bold"
                    CheckedChanged="boldBarCheckItem_CheckChanged" />
            </dxb:BarManager.Items>
            <dxb:BarManager.Bars>
                <dxb:Bar x:Name="formatBar"
                    Caption="Format">
                    <dxb:Bar.DockInfo>
                        <dxb:BarDockInfo
                            ContainerType="Top"
                            Row="0" />
                    </dxb:Bar.DockInfo>
                    <dxb:Bar.ItemLinks>
                        <dxb:BarCheckItemLink BarItemName="boldBarCheckItem" />
                    </dxb:Bar.ItemLinks>
                </dxb:Bar>
            </dxb:BarManager.Bars>
            <DockPanel x:Name="dockPanel"
                LastChildFill="False">
                <dxb:BarContainerControl x:Name="barContainerControl"
                    DockPanel.Dock="Top"
                    ContainerType="Top">
                </dxb:BarContainerControl>
            </DockPanel>
        </dxb:BarManager>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System;
using System.Windows;
using System.Windows.Media.Imaging;

using DevExpress.Xpf.Bars;

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

        #region 생성자 - MainWindow()

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

            BitmapImage italicBitmapImage      = new BitmapImage(new Uri("pack://application:,,/Image/italic16x16.png"));
            BitmapImage italicLargeBitmapImage = new BitmapImage(new Uri("pack://application:,,/Image/italic32x32.png"));

            BarCheckItem italicBarCheckItem = new BarCheckItem()
            {
                Content    = "Italic",
                Glyph      = italicBitmapImage,
                LargeGlyph = italicLargeBitmapImage,
                GlyphSize  = GlyphSize.Small
            };

            italicBarCheckItem.CheckedChanged += new ItemClickEventHandler(italicBarCheckItem_CheckedChanged);

            this.barManager.Items.Add(italicBarCheckItem);

            this.barManager.Bars["formatBar"].ItemLinks.Add(italicBarCheckItem.CreateLink());

            BarManagerCategory barManagerCategory = new BarManagerCategory() { Name = "My category" };

            this.barManager.Categories.Add(barManagerCategory);

            italicBarCheckItem.Category = barManagerCategory;
        }

        #endregion

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

        #region Bold Bar 체크 항목 체크 변경시 처리하기 - boldBarCheckItem_CheckChanged(sender, e)

        /// <summary>
        /// Bold Bar 체크 항목 체크 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void boldBarCheckItem_CheckChanged(object sender, ItemClickEventArgs e)
        {
        }

        #endregion
        #region Italic Bar 체크 항목 체크 변경시 처리하기 - italicBarCheckItem_CheckedChanged(sender, e)

        /// <summary>
        /// Italic Bar 체크 항목 체크 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void italicBarCheckItem_CheckedChanged(object sender, ItemClickEventArgs e)
        {
        }

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

댓글을 달아 주세요