Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DigitalData.GUIs.ClientSuite

Public Class DocumentPanel
    Inherits BasePanel

    Public WriteOnly Property Datasource As DataTable
        Set(value As DataTable)
            GridControlMain.DataSource = value
        End Set
    End Property

    Private Sub DocumentPanel_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim oGridPatcher As New ClassControlPatcher(Of GridControl)(Me)
        oGridPatcher.
            ProcessContainer(AddressOf GridControlDefaults.DefaultGridSettings).
            ProcessContainer(AddressOf GridControlDefaults.ReadOnlyGridSettings)
    End Sub

    Private Sub GridViewMain_RowClick(sender As Object, e As RowClickEventArgs) Handles GridViewMain.RowClick
        If e.Button = MouseButtons.Left And e.Clicks = 2 Then
            MsgBox($"Open Preview for form {OwnerForm}")

            'TODO: Open Preview Panel for OwnerForm
        End If
    End Sub
End Class
