-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRepositoryItemCustomEdit.cs
58 lines (52 loc) · 1.94 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
using System;
using System.Collections.Generic;
using System.Linq;
using DevExpress.XtraEditors.Repository;
using System.Drawing;
using System.Reflection;
using DevExpress.XtraEditors.Registrator;
using DevExpress.XtraEditors.Drawing;
namespace CustomEditor {
//The attribute that points to the registration method
[UserRepositoryItem("RegisterCustomEdit")]
public class RepositoryItemCustomEdit : RepositoryItemRichTextEdit {
//The static constructor which calls the registration method
static RepositoryItemCustomEdit() {
RegisterCustomEdit();
}
//Initialize new properties
public RepositoryItemCustomEdit() {
}
//The unique name for the custom editor
public const string CustomEditName = "CustomEdit";
//Return the unique name
public override string EditorTypeName {
get { return CustomEditName; }
}
//Register the editor
public static void RegisterCustomEdit() {
//Icon representing the editor within a container editor's Designer
Image img = null;
try {
img = (Bitmap)Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.CustomEditors.CustomEdit.bmp"));
}
catch {
}
EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomEditName, typeof(CustomEdit), typeof(RepositoryItemCustomEdit), typeof(CustomEditViewInfo), new RichTextEditPainter(), true, img));
}
//Override the Assign method
public override void Assign(RepositoryItem item) {
BeginUpdate();
try {
base.Assign(item);
var source = item as RepositoryItemCustomEdit;
if (source == null) {
return;
}
}
finally {
EndUpdate();
}
}
}
}