public void ChangeListBoxConText(string msg) { if (LCProperty == null || LCProperty.Any(x => x.LCs == null)) { return; } var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is MyListBox)) { parent = VisualTreeHelper.GetParent(parent); } ListContext lc = LCProperty.Where(x => x.msg == msg).First(); ((MyListBoxItem)((MyListBox)parent).Items[LBIndex + 1]).LCProperty = lc.LCs; // ((MyListBox)parent).ScrollIntoView(((MyListBox)parent).Items[LBIndex + 1]); listbox.SelectedItem = lc; ((MyListBox)parent).ScrollView(LBIndex + 1); this.IsHitTestVisible = false; //foreach (var item in VisualTreeExtern.FindVisualChild<MyTextBlock>(this)) //{ // item.IsHitTestVisible = false; //} MainWindow.Wait(300); this.IsHitTestVisible = true; //foreach (var item in VisualTreeExtern.FindVisualChild<MyTextBlock>(this)) //{ // item.IsHitTestVisible = true; //} }
private void BackBtn_Click(object sender, RoutedEventArgs e) { if (Items.Count <= 0) { return; } foreach (var item in VisualTreeExtern.FindVisualChild <MyListBoxItem>(this)) { item.IsHitTestVisible = false; } SelectedIndex = Math.Max(0, SelectedIndex); ScrollIntoView(Items[(Math.Max(0, --SelectedIndex))]); MainWindow.Wait(300); foreach (var item in VisualTreeExtern.FindVisualChild <MyListBoxItem>(this)) { item.IsHitTestVisible = true; } }
public override void Test(object TestObj, CancellationToken token, ManualResetEvent resetEvent) { Console.WriteLine("TestClass1 test start"); for (int i = 0; i < 80; i++) { resetEvent.WaitOne(); if (token.IsCancellationRequested) { return; } if (TestObj is IPD) { App.Current.Dispatcher.Invoke((Action)(() => { ((IPD)TestObj).SetProgressBar((i + 1) / 80.0); //System.Threading.Thread.Sleep(100); })); MainWindow.Wait(100); } } Console.WriteLine("TestClass1 test end"); base.Test(TestObj, token, resetEvent); }