资源简介
最近用到WPF的表格控件,需要使用分页功能,找了很多例子都不是很满意。有些是模仿SL做的DataPager导航条,使用的时候还要和DataGrid组合使用,不是很方便。最好还是继承DataGrid的分页表格控件。 于是自己动手封装了一个分页表格。
代码片段和文件信息
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.ComponentModel;
namespace CustomControlLibrary {
///
/// DataPager.xaml 的交互逻辑
///
public partial class DataPager : UserControl INotifyPropertyChanged {
public DataPager() {
InitializeComponent();
}
#region 依赖属性和事件
public int PageSize {
get { return (int)GetValue(PageSizeProperty); }
set { SetValue(PageSizeProperty value); }
}
// Using a DependencyProperty as the backing store for PageSize. This enables animation styling binding etc...
public static readonly DependencyProperty PageSizeProperty =
DependencyProperty.Register(“PageSize“ typeof(int) typeof(DataPager) new UIPropertymetadata(10));
public int Total {
get { return (int)GetValue(TotalProperty); }
set { SetValue(TotalProperty value); }
}
// Using a DependencyProperty as the backing store for Total. This enables animation styling binding etc...
public static readonly DependencyProperty TotalProperty =
DependencyProperty.Register(“Total“ typeof(int) typeof(DataPager) new UIPropertymetadata(0));
public int PageIndex {
get { return (int)GetValue(PageIndexProperty); }
set { SetValue(PageIndexProperty value); }
}
// Using a DependencyProperty as the backing store for PageIndex. This enables animation styling binding etc...
public static readonly DependencyProperty PageIndexProperty =
DependencyProperty.Register(“PageIndex“ typeof(int) typeof(DataPager) new UIPropertymetadata(1));
public string PageSizeList {
get { return (string)GetValue(PageSizeListProperty); }
set { SetValue(PageSizeListProperty value); }
}
// Using a DependencyProperty as the backing store for PageSizeList. This enables animation styling binding etc...
public static readonly DependencyProperty PageSizeListProperty =
DependencyProperty.Register(“PageSizeList“ typeof(string) typeof(DataPager) new UIPropertymetadata(“51020“ (s e) => {
DataPager dp = s as DataPager;
if (dp.PageSizeItems == null) dp.PageSizeItems = new List();
else dp.PageSizeItems.Clear();
dp.RaisePropertyChanged(“PageSizeItems“);
}));
public IEnumerableject> ItemsSource {
get { return (IEnumerableject>)GetValue(ItemsSourceProperty); }
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 121344 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\bin\Debug\CustomControlLibrary.dll
文件 112128 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\bin\Debug\CustomControlLibrary.pdb
文件 932 2012-05-28 13:20 PagingDataGrid\CustomControlLibrary\Converter\String2ListConverter.cs
文件 5232 2012-05-29 13:32 PagingDataGrid\CustomControlLibrary\CustomControlLibrary.csproj
文件 227 2012-05-28 16:17 PagingDataGrid\CustomControlLibrary\CustomControlLibrary.csproj.user
文件 3630 2012-05-29 10:51 PagingDataGrid\CustomControlLibrary\DataPager.xaml
文件 10533 2012-05-29 11:15 PagingDataGrid\CustomControlLibrary\DataPager.xaml.cs
文件 680 2012-05-29 11:10 PagingDataGrid\CustomControlLibrary\ImageButton.xaml
文件 2585 2012-05-29 08:58 PagingDataGrid\CustomControlLibrary\ImageButton.xaml.cs
文件 40112 2012-05-29 09:09 PagingDataGrid\CustomControlLibrary\ImageButtonChrome.cs
文件 925 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_first.gif
文件 13410 2012-05-29 08:39 PagingDataGrid\CustomControlLibrary\Images\pagination_first_gray.gif
文件 923 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_last.gif
文件 13410 2012-05-29 08:38 PagingDataGrid\CustomControlLibrary\Images\pagination_last_gray.gif
文件 827 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_load.png
文件 1737 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_loading.gif
文件 875 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_next.gif
文件 13266 2012-05-29 08:39 PagingDataGrid\CustomControlLibrary\Images\pagination_next_gray.gif
文件 879 2012-05-28 09:02 PagingDataGrid\CustomControlLibrary\Images\pagination_prev.gif
文件 13269 2012-05-29 08:39 PagingDataGrid\CustomControlLibrary\Images\pagination_prev_gray.gif
文件 1799 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary.csproj.FileListAbsolute.txt
文件 121344 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary.dll
文件 79563 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary.g.resources
文件 112128 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary.pdb
文件 180 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary.Properties.Resources.resources
文件 283 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary_MarkupCompile.cache
文件 284 2012-05-29 14:57 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary_MarkupCompile.i.cache
文件 182 2012-05-29 14:57 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary_MarkupCompile.i.lref
文件 291 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\CustomControlLibrary_MarkupCompile.lref
文件 3399 2012-05-29 14:58 PagingDataGrid\CustomControlLibrary\obj\Debug\DataPager.baml
............此处省略88个文件信息
相关资源
- wpf基于TreeView控件的Demo
- wpf动画 - 跟随鼠标移动
- 用WPF自定义CheckBox的样式(框框和钩钩
- WPF数学三角尺三角板
- C# WPF 状态栏图标特效 类似QQ/MSN的状态
- C#编写的图像均衡化、去噪、高斯模糊
- WPF通过UserControl动态生成向导
- WPF Visifire Chart Gauges 5.1.3.0 破解版
- 一个用WPF编写的串口助手
- WPFGRAPHICS.zip
- C# WPF+MVVM+EF+多语言
- C#CircularProgressBar
- WPF-自定义控件
- LoadingMaskWPF加载数据loading遮罩
- WPF ScrollViewer(滚动条) 自定义样式表
- 完美实现ComBox多列下拉框+自动完成
- 利用WPF的ScaleTransform和TranslateTransfor
- wpf界面切换特效
- WPF程序调用本机摄像头拍照
- C# 三层架构实现DataGridView与Listview的增
- c#实现datagridview绑定到数据库的图像点
- wpf仿WIN10画图程序
- wpf中给 treeview 添加 CheckBox和 ContextM
- C#中读取sql server的数据,并在datagri
- WPF文字滚动播放效果源码
- C#&SQLite 学生信息管理系统
- WPF动画界面以及WCF通讯框架实现即时
- WPF下基于geplugin的对google earth的开发
- 实时用户在线列表和在线统计(asp.
- WPF动态添加行列DATAGRID.zip
评论
共有 条评论