资源简介
项目中需要,参照百度分页实现WPF分页控件,自已写了一个WPF分页控件,分享出来给大家,使用直接将3个文件放在自己工程里即可;
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Secret.Judgement.Data;
using Secret.Judgement.Log;
namespace Secret.Judgement.UI.UC
{
///
/// ChangePage.xaml 的交互逻辑
///
public partial class DataPager2 : UserControl
{
int _totalPages = 10;
public int TotalPages
{
get { return _totalPages; }
set {
_totalPages = value;
if (_totalPages < 10)
{
for (int i = _totalPages + 1; i < 11; i++)
{
Button curBtn = Wrap1.Children[i] as Button;
curBtn.Visibility = System.Windows.Visibility.Hidden;
curBtn.Width = 0;
//curBtn.Margin = ““
}
}
}
}
int _currentPage=1 _prevPage=1;
public int CurrentPage
{
get { return _currentPage; }
set {
_currentPage = value;
}
}
//int _beginPage _endPage;
Button _cancelbtn _selectBtn;
public myDelegate.changePage pageIndexChanged;
public DataPager2()
{
InitializeComponent();
if (_totalPages < 10)
{
for(int i = _totalPages;i<11;i++)
Wrap1.Children[i].Visibility = System.Windows.Visibility.Hidden;
}
}
private void Button_Click_1(object sender RoutedEventArgs e)
{
//_selectBtn = e.Source as Button;
ClickHandler((e.Source as Button).Content.ToString());
}
//private LoadPage
private void ClickHandler(string buttonContent)
{
_prevPage = _currentPage;
if (buttonContent == “◀“)
{
if (_currentPage == 2)
{
Wrap1.Children[0].Visibility = System.Windows.Visibility.Hidden;
}
Wrap1.Children[11].Visibility = System.Windows.Visibility.Visible;
_currentPage--;
}
else if (buttonContent == “▶“)
{
if (_currentPage == (_totalPages-1))
{
Wrap1.Children[11].Visibility = System.Windows.Visibility.Hidden;
}
Wrap1.Children[0].Visibility = System.Windows.Visibility.Visible;
_currentPage++;
}
else
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7965 2017-04-06 21:16 DataPager2.xaml.cs
文件 341 2017-04-01 00:19 myDelegate.cs
文件 3059 2017-04-05 18:53 DataPager2.xaml
相关资源
- C#WPF 右键菜单 显示 事件触发 测试
- WPF loading源码合集汇集好几种loading效
- wpf仿QQ好友分组
- WPF:定制Checkbox样式,让“正确”绿得
- 刘铁猛《深入浅出WPF》全套真高清视
- wpf border 边框不同颜色
- WPF复制粘贴剪切功能.rar
- MVVM,WPF
- C#控制系统声音大小
- wpf 消息提示框仿QQ左下角提示框
-
xm
l文件与WPF中TreeView、Menu交互 -
WPF Application fr
amework (WAF) Nested -
Wpf 样式和模板含 fr
amework 4.5 aero2 - WPF listBox 漂亮的listBOX
- WPF 3D点云显示
- wpf基于TreeView控件的Demo
- WPF分页DataGrid
- 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遮罩
评论
共有 条评论