첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
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="갤러리 컨트롤 생성하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <DataTemplate x:Key="ItemDescriptionDataTemplateKey">
            <TextBlock
                Foreground="Gray"
                Text="{Binding}" />
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <dxb:GalleryControl>
            <dxb:GalleryControl.Gallery>
                <dxb:Gallery
                    IsGroupCaptionVisible="True"
                    FilterCaption="(click to filter groups)"
                    ColCount="2"
                    ItemCheckMode="None"
                    ItemDescriptionTemplate="{StaticResource ResourceKey=ItemDescriptionDataTemplateKey}"
                    IsItemCaptionVisible="True"
                    IsItemDescriptionVisible="True"
                    ItemContentHorizontalAlignment="Left"
                    ItemClick="gallery_ItemClick">
                    <dxb:Gallery.Groups>
                        <dxb:GalleryItemGroup x:Name="galleryItemGroup1"
                            Caption="Misc Group">
                            <dxb:GalleryItemGroup.Items>
                                <dxb:GalleryItem
                                    Caption="Schedule"
                                    Description="Show schedule"
                                    Glyph="pack://application:,,,/Image/address-16x16.png" />
                                <dxb:GalleryItem
                                    Caption="Roles"
                                    Description="Assign roles"
                                    Glyph="pack://application:,,,/Image/role-16x16.png" />
                            </dxb:GalleryItemGroup.Items>
                        </dxb:GalleryItemGroup>
                        <dxb:GalleryItemGroup x:Name="galleryItemGroup2"
                            Caption="Persons">
                            <dxb:GalleryItemGroup.Items>
                                <dxb:GalleryItem
                                    Caption="Employees"
                                    Glyph="pack://application:,,,/Image/employee-16x16.png" />
                                <dxb:GalleryItem
                                    Caption="Persons"
                                    Glyph="pack://application:,,,/Image/person-16x16.png" />
                                <dxb:GalleryItem
                                    Caption="Users"
                                    Glyph="pack://application:,,,/Image/user-16x16.png" />
                            </dxb:GalleryItemGroup.Items>
                        </dxb:GalleryItemGroup>
                    </dxb:Gallery.Groups>
                </dxb:Gallery>
            </dxb:GalleryControl.Gallery>
        </dxb:GalleryControl>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System.Windows;

using DevExpress.Xpf.Bars;

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

        #region 생성자 - MainWindow()

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

        #endregion

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

        #region 갤러리 항목 클릭시 처리하기 - gallery_ItemClick(sender, e)

        /// <summary>
        /// 갤러리 항목 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void gallery_ItemClick(object sender, GalleryItemEventArgs e)
        {
            MessageBox.Show("The " + e.Item.Caption + " item has been clicked");
        }

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

댓글을 달아 주세요