public void VerifyPipsPagerButtonUIABehavior() { RunOnUIThread.Execute(() => { var pipsPager = new PipsPager(); pipsPager.NumberOfPages = 5; Content = pipsPager; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { var rootPanel = VisualTreeHelper.GetChild(Content, 0) as StackPanel; var repeaterRootParent = VisualTreeHelper.GetChild(rootPanel, 1); ItemsRepeater repeater = null; while (repeater == null) { var nextChild = VisualTreeHelper.GetChild(repeaterRootParent, 0); repeater = nextChild as ItemsRepeater; repeaterRootParent = nextChild; } for (int i = 0; i < 5; i++) { var button = repeater.TryGetElement(i); Verify.IsNotNull(button); Verify.AreEqual(i + 1, button.GetValue(AutomationProperties.PositionInSetProperty)); Verify.AreEqual(5, button.GetValue(AutomationProperties.SizeOfSetProperty)); } }); }
private void OnPigsPagerSelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args) { if (sender.SelectedPageIndex > EventsFV.Items.Count) { return; } EventsFV.SelectedIndex = sender.SelectedPageIndex; }
public void OnSelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args) { PreviousPageButtonIsVisibleCheckBox.IsChecked = IsButtonVisible(previousPageButton); NextPageButtonIsVisibleCheckBox.IsChecked = IsButtonVisible(nextPageButton); PreviousPageButtonIsEnabledCheckBox.IsChecked = previousPageButton?.IsEnabled; NextPageButtonIsEnabledCheckBox.IsChecked = nextPageButton?.IsEnabled; CurrentPageIndexTextBlock.Text = $"Current index is: {sender.SelectedPageIndex}"; }
private async void PipsPager_SelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args) { await RunOnUIThreadAsync(CoreDispatcherPriority.Normal, () => { if (sender.NumberOfPages != 0) { ViewModel.SelectedPageIndex = sender.SelectedPageIndex; } }); }
public void VerifyEmptyPagerDoesNotCrash() { RunOnUIThread.Execute(() => { Content = new PipsPager(); }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Verify.IsNotNull(Content); }); }
public void VerifyAutomationPeerBehavior() { RunOnUIThread.Execute(() => { var pipsControl = new PipsPager(); pipsControl.NumberOfPages = 5; Content = pipsControl; var peer = PipsPagerAutomationPeer.CreatePeerForElement(pipsControl); var selectionPeer = peer as ISelectionProvider; Verify.AreEqual(false, selectionPeer.CanSelectMultiple); Verify.AreEqual(true, selectionPeer.IsSelectionRequired); }); }
public void VerifySelectedIndexChangedEventArgs() { PipsPager pager = null; var previousIndex = -2; var newIndex = -2; RunOnUIThread.Execute(() => { pager = new PipsPager(); pager.SelectedIndexChanged += Pager_SelectedIndexChanged; Content = pager; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { VerifySelectionChanged(-1, 0); pager.NumberOfPages = 10; VerifySelectionChanged(-1, 0); pager.SelectedPageIndex = 9; VerifySelectionChanged(0, 9); pager.SelectedPageIndex = 4; VerifySelectionChanged(9, 4); }); void Pager_SelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args) { previousIndex = args.PreviousPageIndex; newIndex = args.NewPageIndex; } void VerifySelectionChanged(int expectedPreviousIndex, int expectedNewIndex) { Verify.AreEqual(expectedPreviousIndex, previousIndex, "Expected PreviousPageIndex:" + expectedPreviousIndex + ", actual: " + previousIndex); Verify.AreEqual(expectedNewIndex, newIndex, "Expected PreviousPageIndex:" + expectedNewIndex + ", actual: " + newIndex); } }