■ GridControl 클래스에서 SparklineEdit 객체를 사용하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
<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> |
▶ MainWindow.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
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 } } |