■ UltraGrid 클래스에서 ICondition 인터페이스를 구현해 조건 포맷팅을 설정하는 방법을 보여준다.
▶ UltraGrid 클래스 : ICondition 인터페이스를 구현해 조건 포맷팅 설정하기 예제 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
using Infragistics.Win; using Infragistics.Win.UltraWinGrid; private UltraGrid ultraGrid; private CustomCondition customCondition = new CustomCondition("Owner"); ... Infragistics.Win.Appearance customAppearance = new Infragistics.Win.Appearance(); customAppearance.BackColor = Color.Blue; customAppearance.ForeColor = Color.White; ConditionValueAppearance conditionValueAppearance = new ConditionValueAppearance(); conditionValueAppearance.Add(this.customCondition, customAppearance); this.ultraGrid.DisplayLayout.Bands[0].Columns["ContactTitle"].ValueBasedAppearance = conditionValueAppearance; |
※ this.customCondition.ValueToCheck 속성을 설정해 체크 값을 변경할 수 있다.
▶ UltraGrid 클래스 : ICondition 인터페이스를 구현해 조건 포맷팅 설정하기 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
using System; using Infragistics.Win; /// <summary> /// 커스텀 조건 /// </summary> public class CustomCondition : ICondition { //////////////////////////////////////////////////////////////////////////////////////////////////// Event ////////////////////////////////////////////////////////////////////////////////////////// Public #region 속성 변경시 - PropertyChanged /// <summary> /// 속성 변경시 /// </summary> public event EventHandler PropertyChanged; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Field ////////////////////////////////////////////////////////////////////////////////////////// Private #region Field /// <summary> /// 체크 값 /// </summary> private string valueToCheck = string.Empty; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Property ////////////////////////////////////////////////////////////////////////////////////////// Public #region 체크 값 - ValueToCheck /// <summary> /// 체크 값 /// </summary> public string ValueToCheck { get { return this.valueToCheck; } set { this.valueToCheck = value; if(PropertyChanged != null) { PropertyChanged(this, new EventArgs()); } } } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - CustomCondition(valueToCheck) /// <summary> /// 생성자 /// </summary> /// <param name="valueToCheck">체크 값</param> public CustomCondition(string valueToCheck) { this.valueToCheck = valueToCheck; } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Public #region 복제하기 - Clone() /// <summary> /// 복제하기 /// </summary> /// <returns>복제 객체</returns> public object Clone() { return null; } #endregion #region 일치 여부 구하기 - Matches(value, conditionContextProvider) /// <summary> /// 일치 여부 구하기 /// </summary> /// <param name="value">값</param> /// <param name="conditionContextProvider">IConditionContextProvider</param> /// <returns>일치 여부</returns> public bool Matches(object value, IConditionContextProvider conditionContextProvider) { if(value != null) { return (value.ToString().Equals(this.valueToCheck)); } return false; } #endregion } |