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
Public Class TabEnterVC
    Inherits DevExpress.ExpressApp.ViewController(Of DetailView)

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()
        RegisterActions(components)

    End Sub
    Protected Overrides Sub OnViewControlsCreated()
        MyBase.OnViewControlsCreated()
        For Each propertyEditor As PropertyEditor In View.GetItems(Of PropertyEditor)()
            AddHandler propertyEditor.ControlCreated, AddressOf propertyEditor_ControlCreated
        Next
    End Sub
    Private Sub propertyEditor_ControlCreated(sender As Object, e As EventArgs)
        On Error Resume Next
        If TryCast(sender, PropertyEditor) IsNot Nothing Then
            If TryCast(sender, PropertyEditor).Control IsNot Nothing Then
                If TryCast(TryCast(sender, PropertyEditor).Control, Templates.IFrameTemplate) Is Nothing Then
                    Dim type As Type = DirectCast(sender, PropertyEditor).Control.GetType
                    If type.GetProperty("EnterMoveNextControl") IsNot Nothing Then
                        DirectCast(sender, PropertyEditor).Control.EnterMoveNextControl = True
                    End If
                End If
            End If
        End If
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        'For Each propertyEditor As PropertyEditor In View.GetItems(Of PropertyEditor)()
        '    RemoveHandler propertyEditor.ControlCreated, AddressOf propertyEditor_ControlCreated
        'Next
    End Sub
End Class

