■ BaseColumn 클래스의 HeaderTemplate 속성을 컬럼 헤더를 정의하는 DataTemplate를 설정하는 방법을 보여준다.
▶ 예제 코드 (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 |
<Grid xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"> <Grid.Resources> <DataTemplate x:Key="ProductHeaderDataTemplateKey"> <StackPanel Orientation="Horizontal"> <Image Stretch="None" Source="Product.png" /> <TextBlock Margin="5 0 0 0" Foreground="WhiteSmoke" FontWeight="Bold" Text="{Binding}" /> </StackPanel> </DataTemplate> </Grid.Resources> <dxg:GridControl x:Name="gridControl"> <dxg:GridControl.Columns> <dxg:GridColumn HeaderTemplate="{StaticResource ProductHeaderDataTemplateKey}" FieldName="ProductName"> Product </dxg:GridColumn> <dxg:GridColumn FieldName="UnitPrice"> Unit Price </dxg:GridColumn> <dxg:GridColumn FieldName="OrderUnit"> Order Unit </dxg:GridColumn> </dxg:GridControl.Columns> <dxg:GridControl.View> <dxg:TableView AutoWidth="True" /> </dxg:GridControl.View> </dxg:GridControl> </Grid> |