본문 바로가기
WPF - DevExpress

WPF & DevExpress GridControl Basic

by 캡틴노랑이 2021. 3. 19.
반응형

WPF용 DevExpress 기본 그리드 바인드 

 

 

 

 

 

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
<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:WpfSample.DevTest"
      xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
      xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:Serialization="clr-namespace:DevExpress.Xpf.LayoutControl.Serialization;assembly=DevExpress.Xpf.LayoutControl.v17.2"
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
      xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" x:Class="WpfSample.DevTest.Grid01"
      mc:Ignorable="d"
      d:DesignHeight="700" d:DesignWidth="1200"
      Title="Grid01">
    <StackPanel  Margin="0,10,10,10">
        <dxlc:LayoutControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Vertical" >
            <dxlc:LayoutGroup Header="Button" View="GroupBox"  HorizontalAlignment="Stretch" >
                <dx:SimpleButton x:Name="btnSearch" Content="Search" HorizontalAlignment="Left" Click="Button_Click" />
            </dxlc:LayoutGroup>
        </dxlc:LayoutControl>
 
        <dxlc:LayoutControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Orientation="Vertical">
            <dxlc:LayoutGroup Header="Grid" View="GroupBox" HorizontalAlignment="Stretch" Height="500"   >
                <dxg:GridControl x:Name="gcGrid" HorizontalAlignment="Stretch"  ><!--AutoGenerateColumns="AddNew"-->
                    <dxg:GridControl.View>
                        <dxg:TableView AllowPerPixelScrolling="True" ShowTotalSummary="True"/>
                    </dxg:GridControl.View>
                    <dxg:GridControl.Columns >
                        <dxg:GridColumn FieldName="CocktailNo" Header="CocktailNo" Width="100" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CocktailNmKR" Header="CocktailNmKR" Width="*" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CocktailNmEn" Header="CocktailNmEn" Width="*" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CreateType" Header="CreateType" Width="*" ReadOnly="true" />
                        <dxg:GridColumn FieldName="Remark" Header="Remark" Width="*" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CocktailURL" Header="CocktailURL" Width="100" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CocktailScore" Header="CocktailScore" Width="100" ReadOnly="true" />
                        <dxg:GridColumn FieldName="Comment" Header="Comment" Width="*" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CreateUser" Header="CreateUser" Width="100" ReadOnly="true" />
                        <dxg:GridColumn FieldName="CreateDate" Header="CreateDate" Width="100" ReadOnly="true" />                       
                    </dxg:GridControl.Columns>              
                </dxg:GridControl>
            </dxlc:LayoutGroup>
        </dxlc:LayoutControl>
    </StackPanel>
 
</Page>  

 

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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BIZ.Common.Biz;
 
namespace WpfSample.DevTest
{
    /// <summary>
    /// Grid01.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class Grid01 : Page
    {
        public Grid01()
        {
            InitializeComponent();
 
             
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var data = (new CommonCodeBIZ()).Z_UP_COCKTAIL_LIST("dzl");
 
            gcGrid.ItemsSource = data;
        }
    }
}

 

자료형... 상속 받아서 쓰기 때문에.. class 2개 만들어야됨. 참고만 하시길... 이렇게 데이터 나온다는 것에.

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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DTO.Common.Cocktail
{
    [Serializable]
    public class CocktailDTO : CommonDTO
    {
        public string CocktailNo { get; set; }
        public string CocktailNmKR { get; set; }
        public string CocktailNmEn { get; set; }
        public string CreateType { get; set; }                   
        public string CocktailURL { get; set; }
        public int CocktailScore { get; set; }
 
        public string Comment { get; set; }
         
    }
}
 
////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DTO.Common
{
    [Serializable]
    public class CommonDTO
    {
        public string ComCode { get; set; }
        public string Remark { get; set; }
        public string UseYn { get; set; }
        public string DelYN { get; set; }
        public string UserID { get; set; }
        public string CreateUser { get; set; }
        public DateTime CreateDate { get; set; }
        public string UpdateUser { get; set; }
        public DateTime UpdateDate { get; set; }
        public string UpdateStatus { get; set; }//Create, Delete, Update
    }
}

 

 

 

반응형

댓글