This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
87 lines (67 loc) · 2.23 KB
/
MainWindow.xaml.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Windows
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Printing
Namespace WpfPrintGridThemeSync
Partial Public Class MainWindow
Inherits DXWindow
Public Sub New()
InitializeComponent()
End Sub
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
gridControl1.ItemsSource = TabletDataSet.CreateData().Tables(0)
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim link As New PrintableControlLink(CType(gridControl1.View, DevExpress.Xpf.Grid.TableView), "My Document")
Dim preview As New DocumentPreviewWindow()
preview.PreviewControl.DocumentSource = link
link.CreateDocument(True)
ThemeManager.SetThemeName(preview, ThemeManager.GetThemeName(gridControl1))
preview.Show()
End Sub
End Class
#Region "Data for the Grid"
Public Class TabletDataSet
Inherits DataSet
Private Const m_columns As Integer = 5
Private Const m_rows As Integer = 5
Public Sub New()
MyBase.New()
Dim table As New DataTable("table")
DataSetName = "ManualDataSet"
For i As Integer = 0 To m_columns - 1
table.Columns.Add("Column" & i.ToString(), GetType(Int32))
Next i
Tables.AddRange(New DataTable() { table })
End Sub
Public Shared Function CreateData() As TabletDataSet
Dim ds As New TabletDataSet()
Dim table As DataTable = ds.Tables("table")
For i As Integer = 0 To m_rows - 1
Dim row(m_columns - 1) As Object
For j As Integer = 0 To m_columns - 1
row(j) = i * m_columns + j
Next j
table.Rows.Add(row)
Next i
Return ds
End Function
#Region "Disable Serialization for Tables and Relations"
<DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Public Shadows ReadOnly Property Tables() As DataTableCollection
Get
Return MyBase.Tables
End Get
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Public Shadows ReadOnly Property Relations() As DataRelationCollection
Get
Return MyBase.Relations
End Get
End Property
#End Region ' Disable Serialization for Tables and Relations
End Class
#End Region ' Data for the Grid
End Namespace