첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
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:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
    Width="800"
    Height="600"
    Title="TOTAL SUMMARY 표시하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <dxg:TreeListControl x:Name="treeListControl"
            AutoPopulateColumns="True">
            <dxg:TreeListControl.View>
                <dxg:TreeListView x:Name="treeListView"
                    KeyFieldName="ID"
                    ParentFieldName="ParentID"
                    ShowTotalSummary="True" />
            </dxg:TreeListControl.View>
            <dxg:TreeListControl.TotalSummary>
                <dxg:TreeListSummaryItem
                    FieldName="Name"
                    SummaryType="Count" />
            </dxg:TreeListControl.TotalSummary>
        </dxg:TreeListControl>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System.Windows;

using DevExpress.Data;
using DevExpress.Xpf.Grid;

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

        #region 생성자 - MainWindow()

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

            this.treeListControl.ItemsSource = new EmployeeList().GetData();

            this.treeListControl.View.ExpandAllNodes();

            CreateTotalSummary("Age", SummaryItemType.Min    );
            CreateTotalSummary("Age", SummaryItemType.Max    );
            CreateTotalSummary("Age", SummaryItemType.Average);
        }

        #endregion

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

        #region TOTAL SUMMARY 생성하기 - CreateTotalSummary(fieldName, summaryItemType)

        /// <summary>
        /// TOTAL SUMMARY 생성하기
        /// </summary>
        /// <param name="fieldName">필드명</param>
        /// <param name="summaryItemType">SUMMARY 항목 타입</param>
        private void CreateTotalSummary(string fieldName, SummaryItemType summaryItemType)
        {
            TreeListSummaryItem treeListSummaryItem = new TreeListSummaryItem()
            {
                FieldName    = fieldName      ,
                SummaryType  = summaryItemType,
                ShowInColumn = fieldName
            };

            this.treeListControl.TotalSummary.Add(treeListSummaryItem);
        }

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

댓글을 달아 주세요