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. html5的web存储与cookie的区别

    以下从3个方面进行比较: 1,容量:cookie只有4KB,localStorage和sessionStorage最大容量5M 2,是否会携带到ajax中:cookie由每个对服务器的请求来传递,会影 ...

  2. 解决ubuntu 16.04+ Qt 5.7.1无法输入中文的问题

    解决方法: 1.命令行安装fcitx-frontend-qt5 sudo apt-get install fcitx-frontend-qt5 结果显示如下图,说明我的fcitx-frontend-q ...

  3. 语义SLAM的数据关联和语义定位(一)

    语义SLAM和多传感器融合是自动驾驶建图和定位部分比较热门的两种技术.语义SLAM中,语义信息的数据关联相较于特征点的数据关联有所不同.我们一般用特征描述子的相似性来匹配和关联不同图像中的特征点.特征 ...

  4. bootstrap selectpicker 通过代码指定选中值 BootStrap selectpicker后台动态绑定数据 selectpicker 获取选中option的属性或者值

    bootstrap-select使用 bootstrap selectpicker 通过代码指定选中值 $('#subjectno').selectpicker('val',(row.subjectn ...

  5. c#创建文件( File.Create() )后对文件写操作出错的分析

    在C#中,使用system.IO.File.Create()创建完一个文件之后,如果需要对这个文件进行写操作,会出现错误,提示你“这个文件正在被使用”. 原因是System.IO.File.Creat ...

  6. 指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配

    在做通过 PL/SQL 导入Excel 数据的时候,在进行数据库连接的时候,选择DSN为Excel ,输入用户名和密码,进行Connect 出现错误“指定的 DSN 中,驱动程序和应用程序之间的体系结 ...

  7. MySQL 8.0新特性之原子DDL

    文章来源:爱可生云数据库 简介 MySQL8.0 开始支持原⼦ DDL(atomic DDL),数据字典的更新,存储引擎操作,写⼆进制日志结合成了一个事务.在没有原⼦DDL之前,DROP TABLE ...

  8. ZooKeeper 管理脚本

    0. 说明 编写 xzk.sh 脚本,是为了方便在 s101 节点上启动所有的 Zookeeper 进程 1. xzk.sh 脚本 #!/bin/bash ; i<=; i++)) ; do t ...

  9. Linux之因BASH造成的键盘错误和环境问题

    对于Linux我们习惯使用/bin/bash.并且大多数人操作在Centos系统上,但是仍有不少人在ubuntu上使用,两个操作系统大同小异.都是使用了Linux内核.接下来就来讲讲我使用过程中两个系 ...

  10. PyQt5--QColorDiaglog

    # -*- coding:utf-8 -*- ''' Created on Sep 17, 2018 @author: SaShuangYiBing Comment: ''' import sys f ...