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. 图片轮播(Jquery)

    昨天在博客园里面看到imwtr写的图片轮播(淡入淡出)的文章,觉得是否自己可以将该功能写成Jquery插件的形式,也方便之后如果需要的时候可以直接使用. 经过调整和整合,完成了第一版本的jquery. ...

  2. iftop 命令

    在Linux中有一个可以实施监控网络流量的一个工具那就是我们这次要说的iftop命令,这个命令不是系统自带的内置命令,在使用之前是需要先进行安装的 安装方式:yum -y install iftop就 ...

  3. apktool逆向apk包

    在AndroidStudio创建so一节里创建了so,并且在java里面调用so的HelloWorld方法,编译Android Studio后生成包app-debug.apk. 在逆向apk时如果该a ...

  4. Android逆向 APK文件组成

    一 了解APK文件 我们知道Android系统能运行的程序是.apk文件格式,其实它就是一个压缩包而已,把.apk修改成.zip,然后解压就可以得到该apk内部的文件结构. PS: 既然可以把apk文 ...

  5. Git执行过程中出现问题及解决方法

    not-fast-forward https://help.github.com/articles/dealing-with-non-fast-forward-errors/

  6. 【three.js练习程序】创建简单物理场景

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. 精华阅读第 13 期 |常见的八种导致 APP 内存泄漏的问题

    本期是移动开发精英俱乐部的第13期文章,都是以技术为主,所以这里就不过多的进行赘述了,我们直接看干货内容吧!本文系ITOM管理平台OneAPM整理. 实际项目中的MVVM(积木)模式–序章 导读:开篇 ...

  8. python + Jenkins + requests 数据驱动接口测试 环境部署

    ** Jenkins安装: * 安装包选择:Jenkins.war * windows下有msi和war两种格式,我使用的是war,下载下来丢到xmapp的指定目录就行,操作方便一点      * m ...

  9. pycharm的常用快捷键

      使用pycharm写代码时,如果有错误,一般代码右边会有红色标记.   1,写代码时忘记导入模块,可以使用快捷键 Alt + Enter 自动导入模块.() 再倒入模块之前,需要现在pycharm ...

  10. ulimit linux文件配置

    文件描述符在形式上是一个非负整数.实际上,它是一个索引值,指向内核为每一个进程所维护的该进程打开文件的记录表.当程序打开一个现有文件或者创建一个新文件时,内核向进程返回一个文件描述符.在程序设计中,一 ...