private void OnCurrentPageTextBoxKeyUp(object sender, KeyEventArgs e) { var textBox = sender as TextBox; if (!string.IsNullOrWhiteSpace(textBox.Text)) { if (int.TryParse(textBox.Text, out int currentPage)) { PagedSource.MoveToPage(currentPage - 1); SelectPageAndUpdateButtonStates(); } } }
private void OnNumericButtonClick(object sender, RoutedEventArgs e) { var numericButton = sender as NumericButton; if (numericButton.IsEllipsisButton) { var pageIndex = numericButton.PageIndex + (int)Math.Ceiling((double)(NumericButtonCount - 2) / 2); if (pageIndex > PagedSource.PageCount - 1) { pageIndex = PagedSource.PageCount - 1; } PagedSource.MoveToPage(pageIndex); SelectPageAndUpdateButtonStates(); } else { PagedSource.MoveToPage(numericButton.PageIndex); SelectPageAndUpdateButtonStates(); } }