Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Win.Editors
Imports DevExpress.ExpressApp.Win.Core.ModelEditor
Imports DevExpress.XtraEditors

<PropertyEditor(GetType([String]), False)> _
Public Class NotePropertyEditor
    Inherits DXPropertyEditor
    Public Sub New(type As Type, model As IModelMemberViewItem)
        MyBase.New(type, model)
    End Sub
    Protected Overrides Function CreateControlCore() As Object
        Dim control As New ComboBoxEdit

        control.Properties.Sorted = True
        control.Properties.ImmediatePopup = True
        'AddHandler control.Properties.CloseUp, AddressOf control_CloseUp


        'AddHandler control.KeyDown, AddressOf control_KeyDown
        Return control
    End Function

    Private Sub control_PreviewKeyDown(sender As Object, e As Windows.Forms.PreviewKeyDownEventArgs)
        Dim control As ComboBoxEdit = TryCast(sender, ComboBoxEdit)
        If e.KeyCode = Windows.Forms.Keys.F6 Then
            MsgBox(control.Text)
            control.EditValue = control.Text
        End If
    End Sub

    Private Sub control_KeyDown(sender As Object, e As Windows.Forms.KeyEventArgs)
        Dim control As ComboBoxEdit = TryCast(sender, ComboBoxEdit)
        If control.IsPopupOpen Then
            If e.KeyCode = Windows.Forms.Keys.F6 Then
                control.ClosePopup()
                MsgBox(control.Text)
            End If
        End If
    End Sub

    Private Sub control_CloseUp(sender As Object, e As Controls.CloseUpEventArgs)
        'Beep()
    End Sub

End Class
