private static void ValuePropertyChanged(PopUpSearchView arg1, object arg2, SelectionChangedEventArgs arg3) { var parent = arg1.GetParent<MainMenuMetroView>() as MainMenuMetroView; if (parent == null) return; parent.BlokMoveThenPressLeftButton = true; var childs = parent.GetChildrenByName("ProcessGroups"); if (childs == null) return; var scroll = parent.GetChildrenByName("ThumbnailViewerScroller")[0] as ScrollViewer; if (scroll == null) return; var control = childs[0] as ListBox; if (control == null) return; // caluculate y-posision of selected item var listWhight = control.ActualWidth; var index = ((ListBox)arg2).SelectedIndex; var countItems = control.Items.Count; var xPos = (listWhight / countItems) * index; parent.AnimateScrollViewerPosX(xPos <= 0 ? 0 : xPos); }
public void SetFocusTest() { var pop = new PopUpSearchView(); pop.SetFocus("Andrei"); Assert.IsTrue(pop.FilterTextMainMenu.SelectionStart == 6); }