记录在学习与制作WPF过程中遇到的解决方案。
分页控件的制作,邮件发送,日志代码,excel导入导出等代码的实现过程;
二、配置
系统环境:win10
开发工具:Visual Studio 2017
三、功能
1. 分页控件的制作
1.1 前端xaml代码
<UserControl x:Class="SCB.RPS.Client.Controls.UcPager"
xmlns=""
xmlns:x=""
xmlns:mc=""
xmlns:d=""
xmlns:local="clr-namespace:SCB.RPS.Client.Controls"
mc:Ignorable="d" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
<ColumnDefinition />
<ColumnDefinition Width="20" />
<ColumnDefinition />
<ColumnDefinition Width="20" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Label Content="每页显示"/>
<ComboBox Text="{Binding PagerSize}"
Foreground="Orange" VerticalContentAlignment="Center">
<ComboBoxItem Content="10"/>
<ComboBoxItem Content="20"/>
<ComboBoxItem Content="50"/>
</ComboBox>
<Label Content="项"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Label Content="当前显示数目:"/>
<Label Content="{Binding PagerRecord}" Foreground="Orange"/>
</StackPanel>
<StackPanel Grid.Column="4" Orientation="Horizontal">
<Label Content="查询总量:"/>
<Label Content="{Binding PagerQuantity}" Foreground="Orange"/>
<Label Content="页,共"/>
<Label Content="{Binding TotalRecord}" Foreground="Orange"/>
<Label Content="项"/>
</StackPanel>
<StackPanel Grid.Column="6"
Orientation="Horizontal" VerticalAlignment="Center">
<Button Content="首页" Width="40" Height="20" Foreground="White"
Template="{StaticResource DefaultButton}"
Command="{Binding PagerFirst}"/>
<Button Content="上页" Width="60" Height="20" Foreground="White"
Template="{StaticResource DefaultButton}"
Command="{Binding PagerBefore}" />
<Label Content="{Binding PagerIndex}"
Foreground="Orange" ToolTip="当前所在页码"/>
<Button Content="下页" Width="60" Foreground="White"
Template="{StaticResource DefaultButton}"
Command="{Binding PagerAfter}" />
<Button Content="末页" Width="40" Height="20" Foreground="White"
Template="{StaticResource DefaultButton}"
Command="{Binding PagerEnd}" />
</StackPanel>
</Grid>
</UserControl>