//既存グループに追加 private ReThumb Test5() { ReThumb group = Test4();//Group作成 ReThumb reThumb = new(MakeTextBlock("追加要素"), 100, 20); reThumb.GotFocus += MyReThumb_GotFocus; group.Children.Add(reThumb);//追加 return(group); }
//Group解除(未完成、Windowに置くパネル自体もThumbにしないと処理がめんどくさいので、解除は次回) private void Test6() { ReThumb group = Test4();//Group作成 var list = group.UnGroup(); foreach (object item in list) { ReThumb re = item as ReThumb; MyCanvas.Children.Add(re); } }
private void MyReThumb_GotFocus(object sender, RoutedEventArgs e) { ReThumb item = sender as ReThumb; if (item.IsRoot) { MyStackPanel.DataContext = item; } else { ReThumb origin = e.OriginalSource as ReThumb; MyStackPanel.DataContext = origin?.RootReThumb; } }
private void Test2() { MyReThumb2 = new ReThumb(MakeTextBlock("test2"), 100, 100); MyCanvas.Children.Add(MyReThumb2); MyReThumb2.GotFocus += MyReThumb_GotFocus; }
private void Test1() { MyReThumb1 = new ReThumb(MakeTextBlock("test1")); MyCanvas.Children.Add(MyReThumb1); MyReThumb1.GotFocus += MyReThumb_GotFocus; }