첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

▶ XAML

<Grid>
    <Grid.Resources>
        <local:IntegerToBinaryOperatorValueConverter x:Key="IntegerToBinaryOperatorValueConverterKey" />
    </Grid.Resources>
    <dxg:GridControl x:Name="gridControl">
        <dxg:GridControl.Columns>
            <dxg:GridColumn
                FieldName="Index"
                FilterPopupMode="Custom">
                <dxg:GridColumn.CustomColumnFilterPopupTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Label
                                Margin="5"
                                Content="Minimum Index :" />
                                <Slider
                                    Margin="5"
                                    Width="200"
                                    Minimum="1"
                                    Maximum="99"
                                    Value="{Binding Path=CustomColumnFilter,
                                        RelativeSource={RelativeSource TemplatedParent},
                                        Converter={StaticResource IntegerToBinaryOperatorValueConverterKey}}" />
                        </StackPanel>
                    </DataTemplate>
                </dxg:GridColumn.CustomColumnFilterPopupTemplate>
            </dxg:GridColumn>
        </dxg:GridControl.Columns>
        <dxg:GridControl.View>
            <dxg:TableView />
        </dxg:GridControl.View>
    </dxg:GridControl>
</Grid>

 

728x90

 

▶ C#

using System;
using System.Globalization;
using System.Windows.Data;

using DevExpress.Data.Filtering;

/// <summary>
/// 정수↔바이너리 연산자 값 변환자
/// </summary>
public class IntegerToBinaryOperatorValueConverter : IValueConverter
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Method
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 변환하기 - Convert(value, targetType, parameter, cultureInfo)

    /// <summary>
    /// 변환하기
    /// </summary>
    /// <param name="value">값</param>
    /// <param name="targetType">타겟 타입</param>
    /// <param name="parameter">매개 변수</param>
    /// <param name="cultureInfo">CultureInfo 객체</param>
    /// <returns>변환 값</returns>
    public object Convert(object value, Type targetType, object parameter, CultureInfo cultureInfo)
    {
        BinaryOperator binaryOperator = value as BinaryOperator;

        if(object.ReferenceEquals(binaryOperator, null))
        {
            return null;
        }

        OperandValue operandValue = binaryOperator.RightOperand as OperandValue;

        return operandValue.Value;
    }

    #endregion

    #region 역변환하기 - ConvertBack(value, targetType, parameter, cultureInfo)

    /// <summary>
    /// 역변환하기
    /// </summary>
    /// <param name="value">값</param>
    /// <param name="targetType">타겟 타입</param>
    /// <param name="parameter">매개 변수</param>
    /// <param name="cultureInfo">CultureInfo 객체</param>
    /// <returns>역변환 값</returns>
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo cultureInfo)
    {
        return new BinaryOperator("Index", System.Convert.ToInt32(value), BinaryOperatorType.Greater);
    }

    #endregion
}

 

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요