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. SQLServer 学习笔记之超详细基础SQL语句 Part 10

    Sqlserver 学习笔记 by:授客 QQ:1033553122 -----------------------接Part 9------------------- 删除约束的语法 ALTER T ...

  2. SQLServer 学习笔记之超详细基础SQL语句 Part 5

    Sqlserver 学习笔记 by:授客 QQ:1033553122 -----------------------接Part 4------------------- 21使用默认 默认(也称默认值 ...

  3. LeetCode题解之 Convert Sorted Array to Binary Search Tree

    1.题目描述 2.问题分析 使用二分法即可. 3.代码 TreeNode* sortedArrayToBST(vector<int>& nums) { ) return NULL; ...

  4. C# WinForm中添加用户控件

    转:https://blog.csdn.net/haelang/article/details/40681003 有的时候我们需要频繁使用一些系统默认工具的组合,那么就可以使用自定义用户控件. 起一个 ...

  5. android dev概念快速入门

    apk: android将源代码依赖库等经过编译后打包分发的应用. 打包详细过程如下: android-studio安装 由于google被qiang,需要制定proxy,可以使用sock,同时安装完 ...

  6. 获取 MySQL 崩溃时的 core file

    对于一般进程,要让进程崩溃时能生成 core file 用于调试,只需要设置 rlimit 的 core file size > 0 即可.比如,用在 ulimit -c unlimited 时 ...

  7. MySQL binlog group commit--commit stage

    说明: 1.process_commit_stage_queue:调用调用ha_commit_low->innobase_commit进入innodb层依次提交 2. process_after ...

  8. history历史记录控制

    往往我们操作的每一条命令都会被机器记录下来,所有我们为了安全需要屏蔽掉某些敏感的操作命令. 设置linux默认的历史记录数: 临时生效: export  HISTSIZE=5 history 永久生效 ...

  9. Pre标签 自动换行

    <pre> 元素可定义预格式化的文本.被包围在 pre 元素中的文本通常会保留空格和换行符.而文本也会呈现为等宽字体. <pre> 标签的一个常见应用就是用来表示计算机的源代码 ...

  10. HtmlUnit

    htmlunit 是一款开源的java 页面分析工具,读取页面后,可以有效的使用htmlunit分析页面上的内容.项目可以模拟浏览器运行,被誉为java浏览器的开源实现.是一个没有界面的浏览器,运行速 ...