WPF navigator

UI:

<Grid x:Class="WpfApplication2.PagerNav"
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"
d:DesignHeight="68" d:DesignWidth="652">
<Grid>
<Grid Background="WhiteSmoke" Height="33" VerticalAlignment="Center" HorizontalAlignment="Center" Width="333">
<TextBox HorizontalAlignment="Left" Width="61" Height="26" Margin="197,0,0,0" Name="txtPageNum" Text="1"></TextBox>
<Button Content="prev" VerticalAlignment="Center" Height="28" HorizontalAlignment="Left" Margin="6,0,0,0" Name="btnPrev" IsEnabled="True" Width="89" Click="btnPrev_Click" />
<Button Content="next" VerticalAlignment="Center" Height="28" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnNext" IsEnabled="True" Width="89" Click="btnNext_Click" />
<Button Content="go" VerticalAlignment="Center" Height="28" HorizontalAlignment="Left" Margin="261,0,0,0" Name="btnGo" IsEnabled="True" Width="64" Click="btnGo_Click" /> </Grid>
</Grid>
</Grid> Code: 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; namespace WpfApplication2
{
/// <summary>
/// Interaction logic for PagerNav.xaml
/// </summary>
public partial class PagerNav : Grid
{
public PagerNav()
{
InitializeComponent();
} public int pageIndex = 1;
public void btnPrev_Click(object sender, RoutedEventArgs e)
{
pageIndex--;
if (pageIndex < 1) {
pageIndex = 1;
}
txtPageNum.Text =""+ pageIndex;
} private void btnNext_Click(object sender, RoutedEventArgs e)
{
pageIndex++;
txtPageNum.Text = "" + pageIndex;
} private void btnGo_Click(object sender, RoutedEventArgs e)
{ pageIndex = int.Parse("" + txtPageNum.Text); } }
} Main window use: 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; namespace WpfApplication2
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
pagerNav1.btnPrev.Click += new RoutedEventHandler(PagerNav_Click);
pagerNav1.btnNext.Click += new RoutedEventHandler(PagerNav_Click);
pagerNav1.btnGo.Click += new RoutedEventHandler(PagerNav_Click);
} void PagerNav_Click(object sender, RoutedEventArgs e)
{ //lbPager.Content =("out" + pagerNav1.pageIndex);
// do LoadPage(pagerNav1.pageIndex); }
}
}

  

WFP page navigator control的更多相关文章

  1. web forms page和control的生命周期life cycle交互,以及page生命周期中每个event中需要做什么事情

    只有 page_load和page_init这些可以autoeventwireup RenderControl只提供override public override void RenderContro ...

  2. How to parse HTML page data in Windows Phone

    1. Navigate to page WebBrowser control browser.Navigate(new Uri("http://www.xxxx.com")); 2 ...

  3. [AS/400] Control Language(CL) 基本概念

    本文内容源于 Go4AS400 简介 AS400 Control Language(CL) 是由指令(Command)组合而成,用于控制操作和调用系统功能.在 CL 程序中,指令用于和系统 OS400 ...

  4. 自定义SharePoint2013 master page

    SharePoint uses templates to define and render the pages that a site displays. The structure of a Sh ...

  5. 第二篇:呈现内容_第一节:Control呈现

    一.Control的呈现过程 在上个章节““生死有序”的控件生命周期”中,我们提到Render是控件开发的主角,但在控件树的“合成模式(Composite)”部分这位主角却缺席了(戏份太多的缘由).哦 ...

  6. How to develop and deploy ActiveX control in C#

    Link:https://blogs.msdn.microsoft.com/asiatech/2011/12/05/how-to-develop-and-deploy-activex-control- ...

  7. Extended paging tables to map guest physical memory addresses from virtual memory page tables to host physical memory addresses in a virtual machine system

    A processor including a virtualization system of the processor with a memory virtualization support ...

  8. metasploit--exploit模块信息

    Name                                             Disclosure Date  Rank    Description ----           ...

  9. DevExpress控件学习总结 z

    1.Navigation & Layout 1.1 Bar Manager 如果想在窗体或用户控件(user control)上添加工具条(bars)或弹出菜单(popup menus),我们 ...

随机推荐

  1. WebGIS裁剪算法-线裁剪多边形

    在gis系统中 经常会用到一些裁剪的方法,首先推荐一个非常好用的空间分析JavaScript库--Turf.js,不仅功能强大.使用简单,同时处理速度也很快. Turf.js中提供了一中多边形的裁剪方 ...

  2. Lambda表达式 For Android

    Lambda简介 A lambda expression is a block of code with parameters. lambda表达式是带参数的代码块. 虽然看着很先进,其实Lambda ...

  3. 安卓socket聊天

    安卓基于Socket通信(服务器配合) 1.话不多说进入正题,先创建服务端,在Android Studio中创建Java代码,如下图所示: 选择Java Library 需要改名字的自己随意 2.创建 ...

  4. LeetCode题解之Binary Tree Postorder Traversal

    1.题目描述 2.问题分析 递归 3.代码 vector<int> postorderTraversal(TreeNode* root) { vector<int> v; po ...

  5. python 流程控制(while)

    1,while基本语法 2,while else语句 1,while基本语法 n = 1 while n<10: print n n += 1 2,while else语句 n =10 whil ...

  6. Oracle EBS 查看双节点是否做了信任

    perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl verifyssh -contextfile=$CONTEXT_FILE -hosts=erpapp1,erp ...

  7. Python3部分Print输出格式

    print("Hello World!") #直接打印字符串 print('Hello World!') #对于python,单引号也可以表示字符串 name = 'Tom' #自 ...

  8. 通过HTTP参数污染绕过WAF拦截 (转)

    上个星期我被邀请组队去参加一个由CSAW组织的CTF夺旗比赛.因为老婆孩子的缘故,我只能挑一个与Web漏洞利用相关的题目,名字叫做”HorceForce”.这道题价值300点.这道题大概的背景是,你拥 ...

  9. Linux系统之TroubleShooting(启动故障排除)

    尽管Linux系统非常强大,稳定,但是我们在使用过程当中,如果人为操作不当,仍然会影响系统,甚至可能使得系统无法开机,无法运行服务等等各种问题.那么这篇博文就总结一下一些常见的故障排除方法,但是不可能 ...

  10. centos7 安装ldap

    ldap首先我们要知道这个ldap的概念, LDAP是轻量目录访问协议(Lightweight Directory Access Protocol)的缩写 目录是一个为查询.浏览和搜索而优化的专业分布 ...