728x90
기본적으로 Bands 를 활용한 표는 행만 제목으로 추가가 되지 열은 제목(?)으로 추가가 되지 않는다.
대신 열을 같은 데이터끼리 묶을 수 있다. 표의 양식임을 알 수 있도록 GridControl 에 셀 색깔을 넣어 줄 수 있다.
<dxg:GridControlBand Header="헤더1">
<dxg:GridColumn FieldName="BlockType" Header="헤더2">
<!-- 해당 셀에 색깔 넣기 -->
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Border Background="yellow"/>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
저렇게 하니까 GridColum에 Binding 했을 때 텍스트가 덮혀서 아래와 같이 처리했다.
...
<UserControl.Resources>
<Style x:Key="cellStyle" TargetType="dxg:LightweightCellEditor">
<Setter Property="Background" Value="Yellow" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</UserControl.Resources>
...
<dxg:GridControl.Bands >
<dxg:GridControlBand Header="헤더1">
<dxg:GridColumn FieldName="BlockType" Header="헤더2" AllowCellMerge="True" Binding="{Binding BlockType}" CellStyle="{StaticResource cellStyle}"/>
...
728x90
'C# > C# WPF 실무' 카테고리의 다른 글
[C# WPF][DevExpress] band를 이용한 GridControl 의 Header 및 Cell (row) 모두 가운데 정렬하기 (0) | 2023.08.16 |
---|---|
[C# WPF][DevExpress] Band GridControl 에 DataTable 형식으로 Binding 하기 (0) | 2023.08.16 |
[C# WPF][DevExpress] Bands GridControl 제목 행 Background Color 넣기 (0) | 2023.08.16 |
[C# WPF][DevExpress] XYDiagram2D Chart 관련 (0) | 2023.08.09 |
[C# WPF][DevExpress] 다른 속성 선택 시 ComboBox 및 CheckBox 리셋 (0) | 2023.08.09 |