첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ 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

댓글을 달아 주세요