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.Win.Editors

Public Class GridAutoWidthVC
    Inherits DevExpress.ExpressApp.ViewController(Of ListView)

	Public Sub New()
		MyBase.New()

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

    End Sub
    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        AddHandler View.ControlsCreated, AddressOf View_ControlsCreated
    End Sub
    Private Sub View_ControlsCreated(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Try
            DirectCast(DirectCast(View, ListView).Editor, GridListEditor).GridView.OptionsView.ColumnAutoWidth = False
            If TryCast(View, ListView) IsNot Nothing Then
                If CType(View.Model, IModelListViewAllowSort) IsNot Nothing Then
                    DirectCast(DirectCast(View, ListView).Editor, GridListEditor).GridView.OptionsView.RowAutoHeight = CType(View.Model, IModelListViewAllowSort).RowAutoHeight
                End If
            End If
        Catch
        End Try
    End Sub
End Class
