본문 바로가기
WPF - DevExpress

WPF & DevExpress GridControl Cell Merge

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

열 머지는 전체 or 개별 설정을 할 수 있다. 

머진된 행을 선택하면... 분리가 되는데... 이유는 모르겠다.

읽기 전용이어도 분리가 된다.

가로 머지(병합)은 지원하지 않는다.. 하지만. 안되는 것은 아니다. 

 

 

특정열만 머지
전체 열 머지

 

머진된 행 클릭했을 때

 

 

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
<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.Grid07CellMerge"     
      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"  >
                    <dxg:GridControl.View  >
                        <dxg:TableView x:Name="view"  ><!--AllowCellMerge="True"-->
 
                        </dxg:TableView>
                    </dxg:GridControl.View>
                    <dxg:GridControl.Columns >
                        <dxg:GridColumn FieldName="CocktailNo" Header="CocktailNoType1" Width="110" AllowCellMerge="True" ReadOnly="True" />
                        <dxg:GridColumn FieldName="CocktailNoType2" Header="CocktailNoType2" Width="110" />
                        <dxg:GridColumn FieldName="CocktailMaterialNo" Header="CocktailMaterialNo" Width="100" />
                        <dxg:GridColumn FieldName="MaterialCode" Header="MaterialCode" Width="100" />
                        <dxg:GridColumn FieldName="MaterialName" Header="MaterialName" Width="100"  />
                        <dxg:GridColumn FieldName="MaterialQuantity" Header="MaterialQuantity" Width="100" />
                        <dxg:GridColumn FieldName="MaterialUnit" Header="MaterialUnit" Width="100"  />
                        <dxg:GridColumn FieldName="Remark" Header="Remark" Width="100" />
                        <dxg:GridColumn FieldName="UnitPrice" Header="UnitPrice" Width="100" />
                        <dxg:GridColumn FieldName="CreateUser" Header="CreateUser" Width="100" />
                        <dxg:GridColumn FieldName="CreateDate" Header="CreateDate" Width="100" />
                        <dxg:GridColumn FieldName="UpdateUser" Header="UpdateUser" Width="100" />
                        <dxg:GridColumn FieldName="UpdateDate" Header="UpdateDate" Width="100"  />
                    </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
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;
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.Dac;
 
namespace WpfSample.DevTest
{
    /// <summary>
    /// Grid07CellMerge.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class Grid07CellMerge : Page
    {
        public Grid07CellMerge()
        {
            InitializeComponent();
 
            GetBindGrid();
        }
 
        private void GetBindGrid()
        {
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("param1", 333);
 
            var data = (new ADOConnect()).GetDataSet("Kaishaku", "Z_UP_COCKTAIL_MATERIAL_LIST", dic);
 
            gcGrid.ItemsSource = data.Tables[0];
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            GetBindGrid();
        }
    }
}

 

 

전체 병합할 때

1
2
3
4
5
<dxg:GridControl.View  >
    <dxg:TableView x:Name="view" AllowCellMerge="True"  >
 
    </dxg:TableView>
</dxg:GridControl.View>

 

개별열 병합할 때

1
2
3
4
5
6
7
8
9
10
11
12
13
<dxg:GridColumn FieldName="CocktailNo" Header="CocktailNoType1" Width="110" AllowCellMerge="True" ReadOnly="True" />
<dxg:GridColumn FieldName="CocktailNoType2" Header="CocktailNoType2" Width="110" />
<dxg:GridColumn FieldName="CocktailMaterialNo" Header="CocktailMaterialNo" Width="100" />
<dxg:GridColumn FieldName="MaterialCode" Header="MaterialCode" Width="100" />
<dxg:GridColumn FieldName="MaterialName" Header="MaterialName" Width="100"  />
<dxg:GridColumn FieldName="MaterialQuantity" Header="MaterialQuantity" Width="100" />
<dxg:GridColumn FieldName="MaterialUnit" Header="MaterialUnit" Width="100"  />
<dxg:GridColumn FieldName="Remark" Header="Remark" Width="100" />
<dxg:GridColumn FieldName="UnitPrice" Header="UnitPrice" Width="100" />
<dxg:GridColumn FieldName="CreateUser" Header="CreateUser" Width="100" />
<dxg:GridColumn FieldName="CreateDate" Header="CreateDate" Width="100" />
<dxg:GridColumn FieldName="UpdateUser" Header="UpdateUser" Width="100" />
<dxg:GridColumn FieldName="UpdateDate" Header="UpdateDate" Width="100"  />

 

 

반응형

댓글