Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text

Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Win.Editors

Public Class WinLookupLinkViewControllerVC
    Inherits LookupLinkViewController
    Protected Overrides Sub ProcessLookupEditor(ByVal editor As PropertyEditor)
        Dim lookup As LookupPropertyEditor = TryCast(editor, LookupPropertyEditor)
        Dim list As ListPropertyEditor = TryCast(editor, ListPropertyEditor)
        If lookup IsNot Nothing Then
            AddHandler lookup.Control.Popup, AddressOf Control_Popup
        End If
    End Sub
    Private Sub Control_Popup(ByVal sender As Object, ByVal e As EventArgs)
        Dim control As LookupEdit = CType(sender, LookupEdit)
        Dim controller As LinkToLookupViewController = control.Frame.GetController(Of LinkToLookupViewController)()
        If controller IsNot Nothing Then
            For Each editor As LookupPropertyEditor In View.GetItems(Of LookupPropertyEditor)()
                If Equals(editor.Control, control) Then
                    controller.Lookup = editor
                End If
            Next editor
        End If
    End Sub
    Private Sub ListPropertyEditor_ControlCreated(sender As Object, e As EventArgs)

    End Sub
End Class

