- 1
- 0
- 约5千字
- 约 5页
- 2018-11-23 发布于河南
- 举报
翻页自定义控件
翻页自定义控件效果图:前台Xaml代码UserControl x:Class=MT4FollowOrderBackoffice.UC.PagerControl xmlns=/winfx/2006/xaml/presentation xmlns:x=/winfx/2006/xaml xmlns:d=/expression/blend/2008 xmlns:mc=/markup-compatibility/2006 mc:Ignorable=d Name=UC d:DesignHeight=300 d:DesignWidth=300 Height=25StackPanel Orientation=Horizontal Height=25 HorizontalAlignment={Binding HorizontalContentAlignment, ElementName=UC}Button Content=lt; Width=18 Name=btnPrev IsEnabled=False Click=btnPrev_Click /TextBox Width=50 Margin=2,0,0,0 Text={Binding PageIndex, Mode=TwoWay, ElementName=UC}/TextBox Width=50 Margin=2,0,2,0 Text={Binding PageCount, ElementName=UC} IsReadOnly=True/Button Content=gt; Width=18 Name=btnNext IsEnabled=False Click=btnNext_Click /StackPanel Orientation=Horizontal Margin=2,0,0,0Label Content=每页显示/LabelTextBox Width=35 Text={Binding PageSize,Mode=TwoWay,ElementName=UC} Margin=2,0,0,0/TextBoxLabel Margin=2,0,0,0 Content=条/LabelButton Margin=2,0,0,0 Content=OK/Button/StackPanel/StackPanel/UserControl后台代码using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;namespace MT4FollowOrderBackoffice.UC{publicpartialclassPagerControl : UserControl {public PagerControl() { InitializeComponent(); } #region PageSizepublicint PageSize {get { return (int)GetValue(PageSizeProperty); }set { SetValue(PageSizeProperty, value); } }publicstaticreadonlyDependencyProperty PageSizeProperty = DependencyProperty.Register(PageSize,typeof(int),typeof(PagerControl),newPropertyMetadata(15, newPropertyChangedCallback(PageSizePropertyChanged)));staticvoid PageSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {var obj = (PagerControl)d;if ((int)e.NewValue 1) { obj.SetValue(PageSizeProp
原创力文档

文档评论(0)