/
RepositoryItemCustomEdit.cs
73 lines (66 loc) · 2.15 KB
/
RepositoryItemCustomEdit.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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.Skins;
using DevExpress.XtraEditors.Registrator;
using DevExpress.XtraEditors.Repository;
using System.Drawing;
using DevExpress.XtraEditors;
using System.ComponentModel;
using DevExpress.XtraEditors.ViewInfo;
using DevExpress.Utils;
using DevExpress.XtraEditors.Drawing;
namespace DXSample {
[UserRepositoryItem("RegisterCustomEdit")]
public class RepositoryItemCustomEdit : RepositoryItemComboBox
{
static RepositoryItemCustomEdit() { RegisterCustomEdit(); }
public RepositoryItemCustomEdit() { }
public const string CustomEditName = "CustomEdit";
public override string EditorTypeName { get { return CustomEditName; } }
public static void RegisterCustomEdit()
{
Image image = null;
EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomEditName,
typeof(CustomEdit), typeof(RepositoryItemCustomEdit),
typeof(ComboBoxViewInfo), new ButtonEditPainter(), true, image));
}
bool showCloseButton, showClearButton = false;
[DefaultValue(false)]
public bool ShowCloseButton
{
get { return showCloseButton; }
set
{
if (showCloseButton != value)
showCloseButton = value;
}
}
[DefaultValue(false)]
public bool ShowClearButton
{
get { return showClearButton; }
set
{
if (showClearButton != value)
showClearButton = value;
}
}
public override void Assign(RepositoryItem item)
{
BeginUpdate();
try
{
base.Assign(item);
RepositoryItemCustomEdit source = item as RepositoryItemCustomEdit;
if (source == null) return;
showCloseButton = source.showCloseButton;
showClearButton = source.showClearButton;
}
finally
{
EndUpdate();
}
}
}
}