• WFP page navigator control


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

      

  • 相关阅读:
    方差分析 | ANOVA | 原理 | R代码 | 进阶 | one way and two way | Analysis of Variance
    GT sport真实赛道详解
    如何成为F1车手?
    统计学 | 漫想
    (转)什么是P问题、NP问题和NPC问题
    一个完整的成年果蝇大脑的电子显微镜图谱 | A Complete Electron Microscopy Volume of the Brain of Adult Drosophila melanogaster
    文献导读 | A Pan-Cancer Analysis of Enhancer Expression in Nearly 9000 Patient Samples
    综述
    GSEA
    (转)决定系数R2
  • 原文地址:https://www.cnblogs.com/wgscd/p/9599010.html
Copyright © 2020-2023  润新知