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); } } }