■ GridColumn 엘리먼트의 CellTemplate 속성을 사용해 셀을 정의한 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 |
<Page x:Class="HowToShowHyperlinksInGridCells.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"> <dxg:GridControl Name="_pGridControl"> <dxg:GridControl.Columns> <dxg:GridColumn FieldName="Category" Width="200" /> <dxg:GridColumn FieldName="Name" Width="200"> <dxg:GridColumn.CellTemplate> <DataTemplate> <TextBlock> <Hyperlink NavigateUri="{Binding Data.Hyperlink}"> <TextBlock Text="{Binding Data.Name}" /> </Hyperlink> </TextBlock> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> </dxg:GridControl> </Page> |