This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.vb
57 lines (51 loc) · 1.91 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Card
Imports DevExpress.XtraBars.Docking2010.Views.WindowsUI
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraTreeList
Imports DevExpress.XtraEditors
Namespace WindowsFormsApplication35
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
page1.Buttons.AddAction(ContentContainerAction.Exit)
End Sub
Private Sub windowsUIView1_QueryControl(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs) Handles windowsUIView1.QueryControl
If e.Document.Caption = "CardView" Then
e.Control = CreateNewGrid(New CardView())
End If
If e.Document.Caption = "GridView" Then
e.Control = CreateNewGrid(New GridView())
End If
If e.Document.Caption = "TreeList" Then
e.Control = New ListBoxControl() With {.DataSource = GetData()}
End If
End Sub
Public Function CreateNewGrid(ByVal View As BaseView) As GridControl
Dim grid As New GridControl()
grid.DataSource = GetData()
grid.MainView = View
Return grid
End Function
Public Function GetData() As List(Of Person)
Dim list As New List(Of Person)()
list.Add(New Person() With {.FirstName = "Alex", .LastName = "Hunt", .ID = 12321})
list.Add(New Person() With {.FirstName = "James", .LastName = "Bond", .ID = 87452})
list.Add(New Person() With {.FirstName = "Sam", .LastName = "Winchester", .ID = 43598})
list.Add(New Person() With {.FirstName = "Din", .LastName = "Winchester", .ID = 31561})
list.Add(New Person() With {.FirstName = "Derek", .LastName = "Morgan", .ID = 29873})
Return list
End Function
End Class
End Namespace