-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window1.xaml
100 lines (86 loc) · 5.27 KB
/
Window1.xaml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
<Window x:Class="WPFPrintListView.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:WPFPrintListView"
xmlns:coll="clr-namespace:System.Collections.Specialized;assembly=System"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
Loaded="Window_Loaded"
Title="Window1"
Height="367" Width="617">
<Window.Resources>
<Style x:Key="headerTextStyle" TargetType="dxe:TextEdit">
<Setter Property="IsPrintingMode" Value="true" />
<Setter Property="EditMode" Value="InplaceInactive" />
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="Background" Value="#768270"></Setter>
<Setter Property="Foreground" Value="#E9E9E9"></Setter>
<Setter Property="FontFamily" Value="Tahoma"></Setter>
<Setter Property="FontSize" Value="12pt"></Setter>
<Setter Property="BorderThickness" Value="1,1,0,1"></Setter>
<Setter Property="BorderBrush" Value="Blue"></Setter>
</Style>
<Style x:Key="detailTextStyle" TargetType="dxe:TextEdit">
<Setter Property="IsPrintingMode" Value="true" />
<Setter Property="EditMode" Value="InplaceInactive" />
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="Background" Value="Yellow"></Setter>
<Setter Property="Foreground" Value="DarkBlue"></Setter>
<Setter Property="FontFamily" Value="Tahoma"></Setter>
<Setter Property="FontSize" Value="9.75pt"></Setter>
<Setter Property="BorderThickness" Value="1,0,0,1"></Setter>
<Setter Property="BorderBrush" Value="#E6E2E2"></Setter>
</Style>
<src:DateConverter x:Key="dateConverter" />
<DataTemplate x:Key="printHeaderTemplate">
<!--Header-->
<Grid Background="Yellow" Width="350">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<dxe:TextEdit Grid.Row="0" Grid.Column="0" EditValue="GUID" Style="{StaticResource headerTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="1" EditValue="Date" Style="{StaticResource headerTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="2" EditValue="Type" Style="{StaticResource headerTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="3" EditValue="Data" Style="{StaticResource headerTextStyle}" BorderThickness="1,1,1,1" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="printDataTemplate">
<!--Data-->
<Grid Background="AliceBlue" Width="350">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<dxe:TextEdit Grid.Row="0" Grid.Column="0" EditValue="{Binding Path=Content.ID}" Style="{StaticResource detailTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="1" EditValue="{Binding Path=Content.MyDateTime, Converter={StaticResource dateConverter}}" Style="{StaticResource detailTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="2" EditValue="{Binding Path=Content.MyRow}" Style="{StaticResource detailTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="3" EditValue="{Binding Path=Content.MyData}" Style="{StaticResource detailTextStyle}" BorderThickness="1,0,1,1" />
</Grid>
</DataTemplate>
</Window.Resources>
<Grid>
<ListView ItemsSource="{Binding}" Margin="10,10,10,50" Name="listView1">
<ListView.View>
<GridView AllowsColumnReorder="true" ColumnHeaderToolTip="DataTable Information">
<GridViewColumn DisplayMemberBinding="{Binding Path=ID}" Header="GUID" Width="100" />
<GridViewColumn DisplayMemberBinding="{Binding Path=MyDateTime}" Header="Date" Width="100" />
<GridViewColumn DisplayMemberBinding="{Binding Path=MyRow}" Header="Type" Width="100" />
<GridViewColumn DisplayMemberBinding="{Binding Path=MyData}" Header="Data" Width="100" />
</GridView>
</ListView.View>
</ListView>
<Button Margin="0,0,0,10" Name="button1" HorizontalAlignment="Center" Width="75" Click="button1_Click" Height="23" VerticalAlignment="Bottom">Print</Button>
</Grid>
</Window>