■ GridControl 엘리먼트 : 셀 스타일 재정의하기

----------------------------------------------------------------------------------------------------

<Grid

    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"

    xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"

    xmlns:local="clr-namespace:HowToConditionallyApplyStyles">

    <Grid.Resources>

        <local:IntegerToLinearGradientBrushValueConverter x:Key="IntegerToLinearGradientBrushValueConverterKey" />

        <Style x:Key="CellStyleKey"

            BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=CellStyle}}"

            TargetType="dxg:CellContentPresenter">

            <Setter

                Property="Background"

                Value="{Binding Path=RowData.Row.OrderUnit, Converter={StaticResource IntegerToLinearGradientBrushValueConverterKey}}" />

        </Style>

    </Grid.Resources>

    <dxg:GridControl x:Name="gridControl">

        <dxg:GridControl.Columns>

            <dxg:GridColumn

                FieldName="ProductName"

                Header="Product"

                CellStyle="{StaticResource CellStyleKey}" />

            <dxg:GridColumn

                FieldName="UnitPrice"

                Header="Unit Price" />

            <dxg:GridColumn

                FieldName="OrderUnit"

                Header="Units On Order" />

        </dxg:GridControl.Columns>

        <dxg:GridControl.View>

            <dxg:TableView />

        </dxg:GridControl.View>

    </dxg:GridControl>

</Grid>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요