728x90
728x170
▶ IntegerToBinaryOperatorValueConverter.cs
using System;
using System.Globalization;
using System.Windows.Data;
using DevExpress.Data.Filtering;
namespace TestProject
{
/// <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
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
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"
xmlns:local="clr-namespace:TestProject"
Width="800"
Height="600"
Title="커스텀 필터 드롭 다운 생성하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<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>
</Window>
300x250
▶ MainWindow.xaml.cs
using System.Windows;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.gridControl.ItemsSource = new SampleList().GetData();
}
#endregion
}
}
728x90
그리드형(광고전용)
'DevExpress > WPF' 카테고리의 다른 글
[DEVEXPRESS/WPF] GridControl 클래스 : TableView에서 드래그 & 드롭 사용하기 (0) | 2018.03.04 |
---|---|
[DEVEXPRESS/WPF] 편집 셀 간 커스텀 네비게이션 구현하기 (0) | 2018.03.04 |
[DEVEXPRESS/WPF] 행 더블 클릭 처리하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] Per-Pixel 스크롤을 위한 커스텀 스크롤 애니메이션 구현하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] 커스텀 정렬 구현하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] 컬럼의 필터 드롭 다운 내에서 커스텀 필터 항목 만들기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] 커스텀 필터 구현하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] 커스텀 그룹 구현하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] SUMMARY 값으로 그룹 행 정렬하기 (0) | 2018.03.03 |
[DEVEXPRESS/WPF] GridControl 클래스 : CustomSummary 이벤트를 사용해 값이 비어있는 셀 계수하기 (0) | 2018.03.01 |