첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
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:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    Width="800"
    Height="600"
    WindowStartupLocation="CenterScreen"
    Title="GridControl 클래스 : SparklineEdit 객체 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <System:String x:Key="LimitStringKey1">01/02/2000</System:String>
        <System:String x:Key="LimitStringKey2">01/07/2000</System:String>
    </Window.Resources>
    <Grid x:Name="gridControl">
        <Border
            Margin="10"
            CornerRadius="10"
            BorderThickness="5"
            BorderBrush="Gray">
            <dxe:SparklineEdit
                Margin="10"
                PointArgumentMember="ArgumentColumn"
                PointValueMember="ValueColumn"
                EditValue="{Binding SourceCollection}">
                <dxe:SparklineEdit.PointArgumentRange>
                    <dxe:Range
                        Auto="False"
                        Limit1="{Binding Source={StaticResource ResourceKey=LimitStringKey1}}" 
                        Limit2="{Binding Source={StaticResource ResourceKey=LimitStringKey2}}" />
                </dxe:SparklineEdit.PointArgumentRange>
                <dxe:SparklineEdit.StyleSettings>
                    <dxe:AreaSparklineStyleSettings 
                        LineWidth="3"
                        AreaOpacity="0.5"
                        ShowMarkers="True" 
                    
                        MarkerSize="3"
                        MaxPointMarkerSize="10"
                        MinPointMarkerSize="9"
                        StartPointMarkerSize="8"
                        EndPointMarkerSize="7"
                        NegativePointMarkerSize="6"
                    
                        HighlightMaxPoint="True" 
                        HighlightMinPoint="True" 
                        HighlightStartPoint="True"
                        HighlightEndPoint="True"
                        HighlightNegativePoints="True"
                    
                        Brush="DarkBlue"
                        MaxPointBrush="#fff5da2a"
                        MinPointBrush="#ff2B0dea"
                        StartPointBrush="#ff127a0d"
                        EndPointBrush="#fff71616"
                        NegativePointBrush="#ff9c0404"
                        MarkerBrush="Black" />
                </dxe:SparklineEdit.StyleSettings>
            </dxe:SparklineEdit>
        </Border>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Windows;

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

        #region 소스 컬렉션 - SourceCollection

        /// <summary>
        /// 소스 컬렉션
        /// </summary>
        public IList SourceCollection { get; set; }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

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

            this.gridControl.DataContext = this;

            CreateData(7);
        }

        #endregion

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

        #region 데이터 생성하기 - CreateData(dayCount)

        /// <summary>
        /// 데이터 생성하기
        /// </summary>
        /// <param name="dayCount">일 수</param>
        private void CreateData(int dayCount)
        {
            SourceCollection = new ObservableCollection<CustomElement>();

            Random random = new Random();

            for(int i = 1; i <= dayCount; i++)
            {
                SourceCollection.Add
                (
                    new CustomElement()
                    {
                        ArgumentColumn  = new DateTime(2000, 1, i),
                        ValueColumn     = random.Next(20),
                        FilteringColumn = 1
                    }
                );
            }
        }

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

댓글을 달아 주세요