Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128595998/13.2.5%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E2942)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
<!-- default badges end -->
Expand Down
2 changes: 1 addition & 1 deletion VB/Application.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Application x:Class="PrintDocumentFromUIWpf.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml">
<Application x:Class="PrintDocumentFromUIWpf.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
Expand Down
4 changes: 2 additions & 2 deletions VB/Application.xaml.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Imports Microsoft.VisualBasic
Imports System
Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Expand All @@ -12,5 +11,6 @@ Namespace PrintDocumentFromUIWpf
''' </summary>
Partial Public Class App
Inherits Application

End Class
End Namespace
26 changes: 13 additions & 13 deletions VB/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<dxc:DXWindow x:Class="PrintDocumentFromUIWpf.MainWindow"
<dxc:DXWindow x:Class="PrintDocumentFromUIWpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing"
Title="MainWindow" dxc:ThemeManager.ThemeName="Azure"
Height="330" Width="280" Loaded="DXWindow_Loaded">

<dxc:DXWindow.Resources>

<BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />

<DataTemplate x:Key="detailTemplate">
Expand All @@ -34,7 +34,7 @@
</StackPanel>
</DataTemplate>
</dxc:DXWindow.Resources>

<StackPanel>
<GroupBox Header="Document Elements">
<Grid>
Expand All @@ -55,29 +55,29 @@

<Label Margin="5">Report Header:</Label>
<dxe:TextEdit Name="teReportHeader" Grid.Column="2" Margin="5" />

<Label Grid.Row="1" Margin="5">Page Header:</Label>
<dxe:TextEdit Name="tePageHeader" Grid.Column="2" Grid.Row="1" Margin="5" />

<Label Grid.Row="2" Margin="5">Detail Content:</Label>
<dxe:TextEdit Name="teDetail" Grid.Column="2" Grid.Row="2" Margin="5" />

<Label Grid.Row="3" Margin="5">Page Footer:</Label>
<dxe:TextEdit Name="tePageFooter" Grid.Column="2" Grid.Row="3" Margin="5" />

<Label Grid.Row="4" Margin="5">Report Footer:</Label>
<dxe:TextEdit Name="teReportFooter" Grid.Column="2" Grid.Row="4" Margin="5" />

<Label Grid.Row="5" Margin="5">Detail Count:</Label>
<dxe:SpinEdit Name="seDetail" Grid.Column="2" Grid.Row="5" Margin="5" MinValue="0" IsFloatValue="False" IsTextEditable="False" />

<Label Grid.Row="6" Margin="5">Print Page Info:</Label>
<dxe:CheckEdit Name="cePageInfo" Grid.Column="2" Grid.Row="6" Margin="5" HorizontalAlignment="Center" />

</Grid>
</GroupBox>

<Button Width="100" Margin="5" Content="Print Preview" Click="btnPrint_Click" />

</StackPanel>
</dxc:DXWindow>
110 changes: 55 additions & 55 deletions VB/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,59 @@ Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Printing

Namespace PrintDocumentFromUIWpf
Partial Public Class MainWindow
Inherits DXWindow
Public Sub New()
InitializeComponent()
End Sub

Sub DXWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
InitDefaultVlaues()
End Sub

Sub btnPrint_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
CreateAndPreviewLink()
End Sub

Sub InitDefaultVlaues()
teReportHeader.EditValue = "Report Header"
tePageHeader.EditValue = "Page Header"
teDetail.EditValue = "Detail"
tePageFooter.EditValue = "Page Footer"
teReportFooter.EditValue = "Report Footer"
seDetail.EditValue = 400
cePageInfo.EditValue = True
End Sub

Sub CreateAndPreviewLink()
Dim link As New SimpleLink With {
.ReportHeaderTemplate = CType(Resources("reportHeaderTemplate"), DataTemplate),
.PageHeaderTemplate = CType(Resources("pageHeaderTemplate"), DataTemplate),
.DetailTemplate = CType(Resources("detailTemplate"), DataTemplate),
.PageFooterTemplate = CType(Resources("pageFooterTemplate"), DataTemplate),
.ReportFooterTemplate = CType(Resources("reportFooterTemplate"), DataTemplate),
.ReportHeaderData = teReportHeader,
.PageHeaderData = tePageHeader,
.PageFooterData = New PageFooterDataContext With {
.Title = tePageFooter.EditValue.ToString(),
.PrintPageInfo = CBool(cePageInfo.IsChecked)
},
.ReportFooterData = teReportFooter,
.DetailCount = CInt(seDetail.EditValue)
}

AddHandler link.CreateDetail, AddressOf link_CreateDetail

link.ShowPrintPreviewDialog(Me)
End Sub

Sub link_CreateDetail(ByVal sender As Object, ByVal e As CreateAreaEventArgs)
e.Data = String.Format("{0} (Row {1})", teDetail.EditValue, e.DetailIndex)
End Sub
End Class

Public Class PageFooterDataContext
Public Property Title() As String
Public Property PrintPageInfo() As Boolean
End Class
Partial Public Class MainWindow
Inherits DXWindow

Public Sub New()
InitializeComponent()
End Sub

Private Sub DXWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
InitDefaultVlaues()
End Sub

Private Sub btnPrint_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
CreateAndPreviewLink()
End Sub

Private Sub InitDefaultVlaues()
teReportHeader.EditValue = "Report Header"
tePageHeader.EditValue = "Page Header"
teDetail.EditValue = "Detail"
tePageFooter.EditValue = "Page Footer"
teReportFooter.EditValue = "Report Footer"
seDetail.EditValue = 400
cePageInfo.EditValue = True
End Sub

Private Sub CreateAndPreviewLink()
Dim link = New SimpleLink With {
.ReportHeaderTemplate = CType(Resources("reportHeaderTemplate"), DataTemplate),
.PageHeaderTemplate = CType(Resources("pageHeaderTemplate"), DataTemplate),
.DetailTemplate = CType(Resources("detailTemplate"), DataTemplate),
.PageFooterTemplate = CType(Resources("pageFooterTemplate"), DataTemplate),
.ReportFooterTemplate = CType(Resources("reportFooterTemplate"), DataTemplate),
.ReportHeaderData = teReportHeader,
.PageHeaderData = tePageHeader,
.PageFooterData = New PageFooterDataContext With {
.Title = tePageFooter.EditValue.ToString(),
.PrintPageInfo = CBool(cePageInfo.IsChecked)
},
.ReportFooterData = teReportFooter,
.DetailCount = CInt(Math.Truncate(seDetail.EditValue))
}

AddHandler link.CreateDetail, AddressOf link_CreateDetail
link.ShowPrintPreviewDialog(Me)
End Sub

Private Sub link_CreateDetail(ByVal sender As Object, ByVal e As CreateAreaEventArgs)
e.Data = String.Format("{0} (Row {1})", teDetail.EditValue, e.DetailIndex)
End Sub
End Class

Public Class PageFooterDataContext
Public Property Title() As String
Public Property PrintPageInfo() As Boolean
End Class
End Namespace
7 changes: 1 addition & 6 deletions VB/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Imports Microsoft.VisualBasic
Imports System.Reflection
Imports System.Reflection
Imports System.Resources
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Expand Down Expand Up @@ -32,10 +31,6 @@ Imports System.Windows
'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


'(used if a resource is not found in the page,
' or application resource dictionaries)
'(used if a resource is not found in the page,
' app, or any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>


Expand Down
38 changes: 20 additions & 18 deletions VB/My Project/Resources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions VB/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion VB/PrintDocumentFromUIWpf.Net5.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 16
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PrintDocumentFromUIWpf", "PrintDocumentFromUIWpf.Net5.vbproj", "{5189D128-734D-4046-81BE-F12C8A650FFD}"
EndProject
Expand Down
7 changes: 7 additions & 0 deletions VB/PrintDocumentFromUIWpf.Net5.vbproj
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
Expand All @@ -11,9 +12,14 @@
<Platforms>x86;AnyCPU</Platforms>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<DefaultItemExcludes>obj*/**</DefaultItemExcludes>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
</PropertyGroup>
<ItemGroup>
<AppDesigner Include="My Project\" />
Expand All @@ -28,6 +34,7 @@
<PackageReference Include="DevExpress.RichEdit.Core" Version="21.1.*-*" />
<PackageReference Include="DevExpress.RichEdit.Export" Version="21.1.*-*" />
<PackageReference Include="DevExpress.Wpf.Core" Version="21.1.*-*" />
<PackageReference Include="DevExpress.Wpf.Docking" Version="21.1.*-*" />
<PackageReference Include="DevExpress.Wpf.Printing" Version="21.1.*-*" />
<PackageReference Include="DevExpress.Wpf.Reporting" Version="21.1.*-*" />
<PackageReference Include="DevExpress.Wpf.Ribbon" Version="21.1.*-*" />
Expand Down
2 changes: 1 addition & 1 deletion VB/PrintDocumentFromUIWpf.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2012
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PrintDocumentFromUIWpf", "PrintDocumentFromUIWpf.vbproj", "{5189D128-734D-4046-81BE-F12C8A650FFD}"
EndProject
Expand Down
Loading