• 大小: 272KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: C#
  • 标签: WPF  分页  DataGrid  Paging  

资源简介

最近用到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个文件信息

评论

共有 条评论