This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
CustomLookUpEdit.vb
66 lines (61 loc) · 2.09 KB
/
CustomLookUpEdit.vb
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
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraEditors.Registrator
Imports System.ComponentModel
Imports DevExpress.XtraEditors.Controls
Namespace Sample
<UserRepositoryItem("RegisterCustomLookUpEdit")> _
Public Class RepositoryItemCustomLookUpEdit
Inherits RepositoryItemLookUpEdit
Shared Sub New()
RegisterCustomLookUpEdit()
End Sub
Public Sub New()
End Sub
Public Const CustomLookUpEditName As String = "CustomLookUpEdit"
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return CustomLookUpEditName
End Get
End Property
Public Shared Sub RegisterCustomLookUpEdit()
EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(CustomLookUpEditName, GetType(CustomLookUpEdit), GetType(RepositoryItemCustomLookUpEdit), GetType(LookUpEditViewInfo), New ButtonEditPainter(), True))
End Sub
End Class
Public Class CustomLookUpEdit
Inherits LookUpEdit
Shared Sub New()
RepositoryItemCustomLookUpEdit.RegisterCustomLookUpEdit()
End Sub
Public Sub New()
MyBase.New()
End Sub
Protected beforeSearchEditValue As Object
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return RepositoryItemCustomLookUpEdit.CustomLookUpEditName
End Get
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Shadows ReadOnly Property Properties() As RepositoryItemCustomLookUpEdit
Get
Return TryCast(MyBase.Properties, RepositoryItemCustomLookUpEdit)
End Get
End Property
Protected Overrides Sub ProcessFindItem(ByVal helper As KeyPressHelper, ByVal pressedKey As Char)
If helper.PrevText = "" AndAlso helper.Text <> "" Then
beforeSearchEditValue = EditValue
End If
MyBase.ProcessFindItem(helper, pressedKey)
If helper.PrevText <> "" AndAlso helper.Text = "" Then
EditValue = beforeSearchEditValue
End If
End Sub
End Class
End Namespace