This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SerializableFormatCondition.cs
87 lines (71 loc) · 2.46 KB
/
SerializableFormatCondition.cs
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
using DevExpress.Utils;
using DevExpress.Utils.Serializing;
using DevExpress.XtraGrid;
using DevExpress.XtraTreeList.StyleFormatConditions;
namespace E1984 {
public class SerializableFormatCondition
{
private AppearanceObject _appearance = new AppearanceObject();
private bool _applyToRow;
private string _columnName = "";
private FormatConditionEnum _condition;
private object _value1;
private object _value2;
private object _expression;
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
public AppearanceObject Appearance {
get => _appearance;
set => _appearance.Assign(value);
}
[XtraSerializableProperty()]
public string ColumnName {
get => _columnName;
set => _columnName = value;
}
[XtraSerializableProperty()]
public FormatConditionEnum Condition {
get => _condition;
set => _condition = value;
}
[XtraSerializableProperty()]
public bool ApplyToRow {
get => _applyToRow;
set => _applyToRow = value;
}
[XtraSerializableProperty()]
public object Value1 {
get => _value1;
set => _value1 = value;
}
[XtraSerializableProperty()]
public object Value2 {
get => _value2;
set => _value2 = value;
}
[XtraSerializableProperty()]
public object Expression {
get => _expression;
set => _expression = value;
}
public void CopyFromStyleFormat(StyleFormatCondition style)
{
Appearance = style.Appearance;
ApplyToRow = style.ApplyToRow;
ColumnName = style.Column == null? string.Empty: style.Column.Name;
Condition = style.Condition;
Value1 = style.Value1;
Value2 = style.Value2;
Expression = style.Expression;
}
public void CopyToStyleFormat(StyleFormatCondition style)
{
style.Appearance.Assign(Appearance);
style.ApplyToRow = ApplyToRow;
style.Column = ((StyleFormatConditionCollection)style.Collection).TreeListControl.Columns.ColumnByName(ColumnName);
style.Condition = Condition;
style.Value1 = Value1;
style.Value2 = Value2;
style.Expression = Expression.ToString();
}
}
}