728x90
반응형
728x170
▶ IAttribute.cs
namespace TestProject
{
/// <summary>
/// 어트리뷰트 인터페이스
/// </summary>
/// <typeparam name="T">타입</typeparam>
public interface IAttribute<T>
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 값 - Value
/// <summary>
/// 값
/// </summary>
T Value { get; }
#endregion
}
}
728x90
▶ DescriptionAttribute.cs
using System;
namespace TestProject
{
/// <summary>
/// 설명 어트리뷰트
/// </summary>
public class DescriptionAttribute : Attribute, IAttribute<string>
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 설명
/// </summary>
private readonly string description;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 값 - Value
/// <summary>
/// 값
/// </summary>
public string Value
{
get
{
return this.description;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - DescriptionAttribute(description)
/// <summary>
/// 생성자
/// </summary>
/// <param name="description">설명</param>
public DescriptionAttribute(string description)
{
this.description = description;
}
#endregion
}
}
300x250
▶ IconURIAttribute.cs
using System;
namespace TestProject
{
/// <summary>
/// 아이콘 URI 어트리뷰트
/// </summary>
public class IconURIAttribute : Attribute, IAttribute<string>
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 아이콘 URI
/// </summary>
private readonly string iconURI;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 값 - Value
/// <summary>
/// 값
/// </summary>
public string Value
{
get
{
return this.iconURI;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - IconURIAttribute(iconURI)
/// <summary>
/// 생성자
/// </summary>
/// <param name="iconURI">아이콘 URI</param>
public IconURIAttribute(string iconURI)
{
this.iconURI = iconURI;
}
#endregion
}
}
반응형
▶ PriorityLevelAttribute.cs
using System;
namespace TestProject
{
/// <summary>
/// 우선 순위 레벨 어트리뷰트
/// </summary>
public class PriorityLevelAttribute : Attribute, IAttribute<int>
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 우선 순위 레벨
/// </summary>
private readonly int priorityLevel;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 값 - Value
/// <summary>
/// 값
/// </summary>
public int Value
{
get
{
return this.priorityLevel;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - PriorityLevelAttribute(priorityLevel)
/// <summary>
/// 생성자
/// </summary>
/// <param name="priorityLevel">우선 순위 레벨</param>
public PriorityLevelAttribute(int priorityLevel)
{
this.priorityLevel = priorityLevel;
}
#endregion
}
}
▶ EnumerationExtension.cs
using System;
using System.Reflection;
namespace TestProject.Extension
{
/// <summary>
/// 열거형 확장
/// </summary>
public static class EnumerationExtension
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Static
//////////////////////////////////////////////////////////////////////////////// Public
#region 어트리뷰트 값 구하기 - GetAttributeValue<TAttribute, TAttributeValue>(value)
/// <summary>
/// 어트리뷰트 값 구하기
/// </summary>
/// <typeparam name="TAttribute">어트리뷰트 타입</typeparam>
/// <typeparam name="TAttributeValue">어트리뷰트 값 타입</typeparam>
/// <param name="value">열거형 값</param>
/// <returns>어트리뷰트 값</returns>
public static TAttributeValue GetAttributeValue<TAttribute, TAttributeValue>(this Enum value)
{
TAttributeValue attributeValue = default(TAttributeValue);
if(value != null)
{
FieldInfo fieldInfo = value.GetType().GetField(value.ToString());
if(fieldInfo != null)
{
TAttribute[] attributeArray = fieldInfo.GetCustomAttributes(typeof(TAttribute), false) as TAttribute[];
if(attributeArray != null && attributeArray.Length > 0)
{
IAttribute<TAttributeValue> attribute = attributeArray[0] as IAttribute<TAttributeValue>;
if(attribute != null)
{
attributeValue = attribute.Value;
}
}
}
}
return attributeValue;
}
#endregion
}
}
▶ AutoFilterColumn.cs
using System.Collections;
using System.ComponentModel;
namespace TestProject
{
/// <summary>
/// 자동 필터 컬럼
/// </summary>
/// <typeparam name="TItem">항목 타입</typeparam>
public class AutoFilterColumn<TItem> : INotifyPropertyChanged
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Event
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 속성 변경시 이벤트 - PropertyChanged
/// <summary>
/// 속성 변경시 이벤트
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 값
/// </summary>
private object value;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 부모 - Parent
/// <summary>
/// 부모
/// </summary>
public AutoFilterCollection<TItem> Parent { get; set; }
#endregion
#region 명칭 - Name
/// <summary>
/// 명칭
/// </summary>
public string Name { get; set; }
#endregion
#region 레벨 - Level
/// <summary>
/// 레벨
/// </summary>
public int? Level { get; set; }
#endregion
#region 값 - Value
/// <summary>
/// 값
/// </summary>
public object Value
{
get
{
return this.value;
}
set
{
if(this.value == value)
{
return;
}
this.value = value;
Parent.NotifyAll();
}
}
#endregion
#region 중복 제거 값 열거 가능형 - DistinctValueEnumerable
/// <summary>
/// 중복 제거 값 열거 가능형
/// </summary>
public IEnumerable DistinctValueEnumerable
{
get
{
IEnumerable enumerable = Parent.GetValueEnumerableForFilter(Name);
return enumerable;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Internal
#region 통지하기 - Notify()
/// <summary>
/// 통지하기
/// </summary>
internal void Notify()
{
FirePropertyChangedEvent("DistinctValueEnumerable");
}
#endregion
////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 속성 변경시 이벤트 발생시키기 - FirePropertyChangedEvent(propertyName)
/// <summary>
/// 속성 변경시 이벤트 발생시키기
/// </summary>
/// <param name="propertyName">속성명</param>
protected void FirePropertyChangedEvent(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}
▶ AutoFilterCollection.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace TestProject
{
/// <summary>
/// 자동 필터 컬렉션
/// </summary>
/// <typeparam name="TItem">항목 타입</typeparam>
public class AutoFilterCollection<TItem> : INotifyPropertyChanged
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Event
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 속성 변경시 이벤트 - PropertyChanged
/// <summary>
/// 속성 변경시 이벤트
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 소스 열거 가능형
/// </summary>
private IEnumerable<TItem> sourceEnumerable;
/// <summary>
/// 자동 필터 컬럼 리스트
/// </summary>
private readonly List<AutoFilterColumn<TItem>> autoFilterColumnList = new List<AutoFilterColumn<TItem>>();
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 소스 열거 가능형 - SourceEnumerable
/// <summary>
/// 소스 열거 가능형
/// </summary>
public IEnumerable<TItem> SourceEnumerable
{
get
{
return this.sourceEnumerable;
}
set
{
if(this.sourceEnumerable != value)
{
this.sourceEnumerable = value;
Calculate();
}
}
}
#endregion
#region 자동 필터 컬럼 리스트 - AutoFilterColumnList
/// <summary>
/// 자동 필터 컬럼 리스트
/// </summary>
public List<AutoFilterColumn<TItem>> AutoFilterColumnList
{
get
{
return this.autoFilterColumnList;
}
}
#endregion
#region 필터 열거 가능형 - FilteredEnumerable
/// <summary>
/// 필터 열거 가능형
/// </summary>
public IEnumerable<TItem> FilteredEnumerable
{
get
{
IEnumerable<TItem> resultEnumerable = SourceEnumerable;
foreach(AutoFilterColumn<TItem> autoFilterColumn in AutoFilterColumnList)
{
if(autoFilterColumn.Value == null || autoFilterColumn.Value.Equals("All"))
{
continue;
}
PropertyInfo propertyInfo = typeof(TItem).GetProperty(autoFilterColumn.Name);
resultEnumerable = resultEnumerable.Where(x => propertyInfo.GetValue(x, null).Equals(autoFilterColumn.Value));
}
return resultEnumerable;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Internal
#region 모두 통지하기 - NotifyAll()
/// <summary>
/// 모두 통지하기
/// </summary>
internal void NotifyAll()
{
foreach(AutoFilterColumn<TItem> autoFilterColumn in AutoFilterColumnList)
{
autoFilterColumn.Notify();
}
FirePropertyChangedEvent("FilteredEnumerable");
}
#endregion
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 필터용 값 열거 가능형 구하기 - GetValueEnumerableForFilter(columnName)
/// <summary>
/// 필터용 값 열거 가능형 구하기
/// </summary>
/// <param name="columnName">컬럼명</param>
/// <returns>필터용 값 열거 가능형</returns>
public IEnumerable GetValueEnumerableForFilter(string columnName)
{
IEnumerable<TItem> resultEnumerable = SourceEnumerable;
foreach(AutoFilterColumn<TItem> autoFilterColumn in AutoFilterColumnList)
{
if(autoFilterColumn.Name == columnName)
{
continue;
}
if(autoFilterColumn.Value == null || autoFilterColumn.Value.Equals("All"))
{
continue;
}
PropertyInfo autoFilterColumnPropertyInfo = typeof(TItem).GetProperty(autoFilterColumn.Name);
if(autoFilterColumn.Level == null || AutoFilterColumnList.FirstOrDefault(x => x.Name == columnName).Level >= autoFilterColumn.Level)
{
resultEnumerable = resultEnumerable.Where(x => autoFilterColumnPropertyInfo.GetValue(x, null).Equals(autoFilterColumn.Value));
}
}
PropertyInfo propertyInfo = typeof(TItem).GetProperty(columnName);
List<object> propertyValueList = resultEnumerable.Select(x => propertyInfo.GetValue(x, null)).Concat(new List<object>()).ToList();
propertyValueList.Sort();
return propertyValueList.Distinct();
}
#endregion
#region 자동 필터 컬럼 구하기 - GetAutoFilterColumn(columnName)
/// <summary>
/// 자동 필터 컬럼 구하기
/// </summary>
/// <param name="columnName">컬럼명</param>
/// <returns>자동 필터 컬럼</returns>
public AutoFilterColumn<TItem> GetAutoFilterColumn(string columnName)
{
return AutoFilterColumnList.SingleOrDefault(x => x.Name == columnName);
}
#endregion
////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 속성 변경시 이벤트 발생시키기 - FirePropertyChangedEvent(propertyName)
/// <summary>
/// 속성 변경시 이벤트 발생시키기
/// </summary>
/// <param name="propertyName">속성명</param>
protected void FirePropertyChangedEvent(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 계산하기 - Calculate()
/// <summary>
/// 계산하기
/// </summary>
private void Calculate()
{
PropertyInfo[] propertyInfoArray = typeof(TItem).GetProperties(BindingFlags.Instance | BindingFlags.Public);
foreach(PropertyInfo propertyInfo in propertyInfoArray)
{
int? priorityLevel = null;
object[] attributeArray = propertyInfo.GetCustomAttributes(typeof(Attribute), true);
if(attributeArray != null && attributeArray.Length > 0)
{
PriorityLevelAttribute priorityLevelAttribute = attributeArray[0] as PriorityLevelAttribute;
if(priorityLevelAttribute != null)
{
priorityLevel = priorityLevelAttribute.Value;
}
}
AutoFilterColumnList.Add
(
new AutoFilterColumn<TItem>
{
Parent = this,
Level = priorityLevel,
Name = propertyInfo.Name,
Value = null
}
);
}
}
#endregion
}
}
▶ League.cs
namespace TestProject
{
/// <summary>
/// 리그
/// </summary>
public enum League
{
/// <summary>
/// 아르헨티나 프리메라 디비전
/// </summary>
[IconURI("pack://application:,,,/TestProject;component/IMAGE/Argentina.png")]
[Description("아르헨티나 프리메라 디비전")]
PrimeraDivision = 1,
/// <summary>
/// 영국 프리미어 리그
/// </summary>
[IconURI("pack://application:,,,/TestProject;component/IMAGE/England.png")]
[Description("영국 프리미어 리그")]
PremierLeague = 2,
/// <summary>
/// 스페인 라 리가
/// </summary>
[IconURI("pack://application:,,,/TestProject;component/IMAGE/Spain.png")]
[Description("스페인 라 리가")]
LaLiga = 3
}
}
▶ Football.cs
namespace TestProject
{
/// <summary>
/// 축구
/// </summary>
public class Football
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 리그 - League
/// <summary>
/// 리그
/// </summary>
[PriorityLevel(1)]
public League League { get; set; }
#endregion
#region 팀 - Team
/// <summary>
/// 팀
/// </summary>
[PriorityLevel(2)]
public string Team { get; set; }
#endregion
#region 선수 수 - PlayerCount
/// <summary>
/// 선수 수
/// </summary>
public int PlayerCount { get; set; }
#endregion
#region 선수명 - PlayerName
/// <summary>
/// 선수명
/// </summary>
public string PlayerName { get; set; }
#endregion
#region 선수 - Player
/// <summary>
/// 선수
/// </summary>
[PriorityLevel(3)]
public string Player
{
get
{
return string.Format("{0} - {1}", PlayerCount, PlayerName);
}
}
#endregion
}
}
▶ FootballCollection.cs
using System.Collections.Generic;
namespace TestProject
{
/// <summary>
/// 축구 컬렉션
/// </summary>
public class FootballCollection : List<Football>
{
}
}
▶ FootballAutoFilterCollection.cs
namespace TestProject
{
/// <summary>
/// 축구 자동 필터 컬렉션
/// </summary>
public class FootballAutoFilterCollection : AutoFilterCollection<Football>
{
}
}
▶ DataHelper.cs
namespace TestProject
{
/// <summary>
/// 데이터 헬퍼
/// </summary>
public class DataHelper
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Static
//////////////////////////////////////////////////////////////////////////////// Public
#region 축구 컬렉션 구하기 - GetFootballCollection()
/// <summary>
/// 축구 컬렉션 구하기
/// </summary>
/// <returns>축구 컬렉션</returns>
public static FootballCollection GetFootballCollection()
{
FootballCollection collection = new FootballCollection
{
new Football
{
League = League.PremierLeague,
Team = "Manchester United",
PlayerCount = 9,
PlayerName = "Cristiano Ronaldo"
},
new Football
{
League = League.PremierLeague,
Team = "Manchester United",
PlayerCount = 18,
PlayerName = "Mikael Silvestre"
},
new Football
{
League = League.PremierLeague,
Team = "Arsenal",
PlayerCount = 18,
PlayerName = "Mikael Silvestre"
},
new Football
{
League = League.LaLiga,
Team = "Real Madrid",
PlayerCount = 9,
PlayerName = "Cristiano Ronaldo"
},
new Football
{
League = League.LaLiga,
Team = "Real Madrid",
PlayerCount = 20,
PlayerName = "Gonzalo Higuain"
},
new Football
{
League = League.LaLiga,
Team = "Racing",
PlayerCount = 24,
PlayerName = "Luis Garcia"
},
new Football
{
League = League.PrimeraDivision,
Team = "Arsenal",
PlayerCount = 6,
PlayerName = "Anibal Matellan"
},
new Football
{
League = League.PrimeraDivision,
Team = "Racing",
PlayerCount = 16,
PlayerName = "Pablo Caballero"
},
new Football
{
League = League.PrimeraDivision,
Team = "River Plate",
PlayerCount = 20,
PlayerName = "Gonzalo Higuain"
},
};
return collection;
}
#endregion
}
}
▶ LeagueIconURIConverter.cs
using System;
using System.Globalization;
using System.Windows.Data;
using TestProject.Extension;
namespace TestProject
{
/// <summary>
/// 리그→아이콘 URI 변환자
/// </summary>
public class LeagueIconURIConverter : IValueConverter
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 변환하기 - Convert(sourceValue, targetType, parameter, cultureInfo)
/// <summary>
/// 변환하기
/// </summary>
/// <param name="sourceValue">소스 값</param>
/// <param name="targetType">타겟 타입</param>
/// <param name="parameter">매개 변수</param>
/// <param name="cultureInfo">문화 정보</param>
/// <returns>변환 값</returns>
public object Convert(object sourceValue, Type targetType, object parameter, CultureInfo cultureInfo)
{
if(sourceValue != null)
{
League league = sourceValue is League ? (League)sourceValue : League.PremierLeague;
string leagueIconURI = league.GetAttributeValue<IconURIAttribute, string>();
return leagueIconURI;
}
return null;
}
#endregion
#region 역변환하기 - ConvertBack(sourceValue, targetType, parameter, cultureInfo)
/// <summary>
/// 역변환하기
/// </summary>
/// <param name="sourceValue">소스 값</param>
/// <param name="targetType">타겟 타입</param>
/// <param name="parameter">매개 변수</param>
/// <param name="cultureInfo">문화 정보</param>
/// <returns>역변환 값</returns>
public object ConvertBack(object sourceValue, Type targetType, object parameter, CultureInfo cultureInfo)
{
return null;
}
#endregion
}
}
▶ LeagueNameConverter.cs
using System;
using System.Globalization;
using System.Windows.Data;
using TestProject.Extension;
namespace TestProject
{
/// <summary>
/// 리그→리그명 변환자
/// </summary>
public class LeagueNameConverter : IValueConverter
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 변환하기 - Convert(sourceValue, targetType, parameter, cultureInfo)
/// <summary>
/// 변환하기
/// </summary>
/// <param name="sourceValue">소스 값</param>
/// <param name="targetType">타겟 타입</param>
/// <param name="parameter">매개 변수</param>
/// <param name="cultureInfo">문화 정보</param>
/// <returns>변환 값</returns>
public object Convert(object sourceValue, Type targetType, object parameter, CultureInfo cultureInfo)
{
if(sourceValue != null)
{
League league = sourceValue is League ? (League) sourceValue : League.PremierLeague;
string description = league.GetAttributeValue<DescriptionAttribute, string>();
return description;
}
return null;
}
#endregion
#region 역변환하기 - ConvertBack(sourceValue, targetType, parameter, cultureInfo)
/// <summary>
/// 역변환하기
/// </summary>
/// <param name="sourceValue">소스 값</param>
/// <param name="targetType">타겟 타입</param>
/// <param name="parameter">매개 변수</param>
/// <param name="cultureInfo">문화 정보</param>
/// <returns>역변환 값</returns>
public object ConvertBack(object sourceValue, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
#endregion
}
}
▶ 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:local="clr-namespace:TestProject"
Width="800"
Height="600"
Title="ComboBox 클래스 : 우선 순위 필터 콤보 박스 사용하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<local:LeagueNameConverter x:Key="LeagueNameConverterKey" />
<local:LeagueIconURIConverter x:Key="LeagueIconURIConverterKey" />
</Window.Resources>
<Grid
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Content="리그" />
<ComboBox Grid.Row="1"
Width="300"
Height="25"
DataContext="{Binding Path=LeagueColumn}"
ItemsSource="{Binding DistinctValueEnumerable}"
SelectedItem="{Binding Value}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image
Margin="4 0 4 0"
Width="16"
Height="16"
Source="{Binding Converter={StaticResource LeagueIconURIConverterKey}}" />
<TextBlock
Text="{Binding Converter={StaticResource LeagueNameConverterKey}}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Label Grid.Row="2"
Margin="0 10 0 0"
Content="팀" />
<ComboBox Grid.Row="3"
Width="300"
Height="25"
DataContext="{Binding Path=TeamColumn}"
ItemsSource="{Binding DistinctValueEnumerable}"
SelectedItem="{Binding Value}" />
<Label Grid.Row="4"
Margin="0 10 0 0"
Content="선수" />
<ComboBox Grid.Row="5"
Width="300"
Height="25"
DataContext="{Binding Path=PlayerColumn}"
ItemsSource="{Binding DistinctValueEnumerable}"
SelectedItem="{Binding Value}" />
</Grid>
</Window>
▶ MainWindow.xaml.cs
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 축구 자동 필터 컬렉션
/// </summary>
private readonly FootballAutoFilterCollection footballAutoFilterCollection = new FootballAutoFilterCollection();
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 리그 컬럼 - LeagueColumn
/// <summary>
/// 리그 컬럼
/// </summary>
public AutoFilterColumn<Football> LeagueColumn
{
get
{
return this.footballAutoFilterCollection.AutoFilterColumnList[0];
}
}
#endregion
#region 팀 컬럼 - TeamColumn
/// <summary>
/// 팀 컬럼
/// </summary>
public AutoFilterColumn<Football> TeamColumn
{
get
{
return this.footballAutoFilterCollection.AutoFilterColumnList[1];
}
}
#endregion
#region 선수 컬럼 - PlayerColumn
/// <summary>
/// 선수 컬럼
/// </summary>
public AutoFilterColumn<Football> PlayerColumn
{
get
{
return this.footballAutoFilterCollection.AutoFilterColumnList[4];
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.footballAutoFilterCollection.SourceEnumerable = DataHelper.GetFootballCollection();
DataContext = this;
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF/.NETCORE] BitmapImage 클래스 : WINFORM Bitmap 객체에서 비트맵 이미지 구하기 (0) | 2021.09.23 |
---|---|
[C#/WPF/.NETCORE] IValueConverter 인터페이스 : 비트맵→비트맵 소스 변환자 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 릴레이 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 매개 변수를 갖는 대리자 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 대리자 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] 대시보드 애니메이션 사용하기 (0) | 2021.09.16 |
[C#/WPF] 확장 메뉴 사용하기 (0) | 2021.09.15 |
[C#/WPF] ToggleButton 클래스 : 드롭 다운 버튼/분리 버튼 사용하기 (0) | 2021.09.14 |
[C#/WPF] 열거형 정렬하기 (0) | 2021.09.13 |
[C#/WPF] UserControl 엘리먼트 : 로딩 패널 사용하기 (0) | 2021.09.13 |
댓글을 달아 주세요