master
editor 2 months ago
commit 39e11d3e1b

@ -0,0 +1,51 @@
WPF分页控件
一、源码描述
WPF分页控件
环境VS2022 WPF
二、功能介绍
一个WPF的自定义控件将List转换成Datatable后绑定到DataGrid上。
三、注意事项
ctrl+F5运行即可。
作者: coderbest
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/WPFControl
------------------------------------------------------------------------------------------------
源码服务专家
官网: https://www.51aspx.com
讨论圈: https://club.51aspx.com/
平台声明:
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
友情提示:
一般数据库文件默认在 DB_51Aspx 文件夹下
默认账号密码一般均为51Aspx
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help

@ -0,0 +1,8 @@
<Application x:Class="DataGridPageDemo.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>
</Application>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace DataGridPageDemo
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}

@ -0,0 +1,15 @@
<UserControl x:Class="DataGridPageDemo.DataGridPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Background="Transparent">
<UserControl.Resources>
<!--每页{0}/共{0}条-->
<Style x:Key="PageTextBlock1" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="FontSize" Value="13" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<!--首页上一页等-->

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
using System.Text.RegularExpressions;

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{769FBA0E-D074-4F27-8858-2928BAE9D44F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataGridPageDemo</RootNamespace>
<AssemblyName>DataGridPageDemo</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.ComponentModel;
namespace DataGridPageDemo
{
public static class Helper
{
/// <summary>
/// 将List转换成DataTable
/// </summary>
/// <typeparam name="T"></typeparam>

@ -0,0 +1,15 @@
<Window x:Class="DataGridPageDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assembly="clr-namespace:System;assembly=mscorlib"
xmlns:my="clr-namespace:DataGridPageDemo"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Window.Resources>
<ObjectDataProvider x:Key="keyCategory" MethodName="GetValues" ObjectType="{x:Type assembly:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type Type="my:ProductCategory"></x:Type>
<!--引用后台的枚举类型为字段类别提供数据源。上面引用了命名空间Demo-->
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<Grid>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Data;

@ -0,0 +1,15 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DataGridPageDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DataGridPageDemo")]
[assembly: AssemblyCopyright("Copyright © 2015")]

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataGridPageDemo.Properties {
using System;
/// <summary>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataGridPageDemo.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
Loading…
Cancel
Save