コード例 #1
0
        private PageButton CreateBtn(int PaginatorIndex, Boolean isCurrent = false)
        {
            PageButton button = new PageButton();

            button.Content              = PaginatorIndex.ToString();
            button.Type                 = (int)ButtonType;
            button.FontSize             = this.FontSize;
            button.IsChecked            = isCurrent;
            button.IndicatorHeight      = SelectedIndicatorHeight;
            button.Tag                  = PageTag;
            button.ActiveForground      = SelectedForground;
            button.ActiveIndicatorColor = this.SelectedIndicatorColor;
            button.ActiveBackground     = this.SelectedBackground;
            button.Background           = this.Background;
            button.Click               += PageButton_Click;
            return(button);
        }
コード例 #2
0
        private void PageButton_Click(object sender, RoutedEventArgs e)
        {
            PageButton button = sender as PageButton;
            String     tag    = button.Tag.ToString();
            int        index  = 0;

            try
            {
                index       = Convert.ToInt32(button.Content);
                CurrentPage = index;
            }
            catch
            {
                // static orther btn
                button.IsChecked = false;
                switch (tag)
                {
                case FirstTag:
                    CurrentPage = 1;
                    break;

                case UpTag:
                    CurrentPage -= 1;
                    break;

                case NextTag:
                    CurrentPage += 1;
                    break;

                case LastTag:
                    CurrentPage = LastPage;
                    break;

                default:
                    break;
                }
            }
        }