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. Java基础笔记(2) 程序入口 关键字 标识符 常量 变量

    提醒:关于那些和我一样新鸟来看资料的,能看懂多少看多少,看不懂的就是不重要,重要的你想我自己学习肯定要标注的,这些信息明白每个知识点实际作用就好了,其他的比如等会讲的常量内存,常量池这些都是我找的资料 ...

  2. Textarea输入字数限制(兼容iOS&安卓)

    最近在做一个微信公众号的页面,其中有对textarea做输入字数限制,而且需要兼容iOS和安卓手机,下面直接贴代码: <!DOCTYPE html> <html lang=" ...

  3. Flutter应用打包发布

    本文学习Flutter打包,打包环境,Android studio3.2,打包的程序就使用上文的酷炫天气预报 terminal执行下列命令: 1.生成key(如果有现成的Key跳过这一步)  2.ke ...

  4. Django ModelForm类生成表单

    1. 定义ModelForm类 #froms.py from django import forms from app01.modles import User class UserModelForm ...

  5. 用 Windows Live Writer 写blog,This is Test……..

    1.下载  Windows Live Writer,百度一下下载地址,不在这里提供下载了. 2.选择安装,其它微软应用不需要就不要安装. 3.里面有很多用的插件很好玩的,点击添加插件.

  6. 《SQL Server 2008从入门到精通》--20180723

    目录 1.架构 1.1.创建架构并在架构中创建表 1.2.删除架构 1.3.修改表的架构 2.视图 2.1.新建视图 2.2.使用视图修改数据 2.3.删除视图 3.索引 3.1.聚集索引 3.2.非 ...

  7. innodb_fast_shutdown的内幕

    Innodb_fast_shutdown告诉innodb在它关闭的时候该做什么工作.有三个值可以选择:1.  0表示在innodb关闭的时候,需要purge all, merge insert buf ...

  8. EF5.0中的跨数据库操作

    以前在用MVC + EF 的项目中,都是一个数据库,一个DbContext,因此一直没有考虑过在MVC+EF的环境下对于多个数据库的操作问题.等到要使用时,才发现这个问题也不小(关键是有个坑).直接说 ...

  9. 使用Index()+Match()函数实现更为灵活的VLookUp()

    上一篇 http://www.cnblogs.com/-SANG/p/8407017.html 文章中已经介绍了vlookup的用法. 今天要使用index+match实现更为灵活的vlookup 先 ...

  10. 【干货】一文理解Druid原理架构(时序数据库,不是ali的数据库连接池)

    Druid.io(以下简称Druid)是2013年底开源出来的, 主要解决的是对实时数据以及较近时间的历史数据的多维查询提供高并发(多用户),低延时,高可靠性的问题. Druid简介: Druid是一 ...