|
10 | 10 | using Windows.UI;
|
11 | 11 | using System.Windows.Input;
|
12 | 12 | using Windows.UI.Xaml.Automation;
|
| 13 | +using Windows.UI.Xaml.Shapes; |
| 14 | +using System.Reflection; |
13 | 15 |
|
14 | 16 | using TabView = Microsoft.UI.Xaml.Controls.TabView;
|
15 | 17 | using TabViewItem = Microsoft.UI.Xaml.Controls.TabViewItem;
|
@@ -55,8 +57,16 @@ public TabViewPage()
|
55 | 57 | itemSource.Add(item);
|
56 | 58 | }
|
57 | 59 | DataBindingTabView.TabItemsSource = itemSource;
|
| 60 | + |
| 61 | + backgroundColorCache = BackgroundGrid.Background; |
| 62 | + activeTabContentBackgroundBrushCache = FirstTabContent.Background; |
| 63 | + CacheFirstTabSelectedBackgroundPathFill(); |
58 | 64 | }
|
59 | 65 |
|
| 66 | + private Brush backgroundColorCache; |
| 67 | + private Brush activeTabSelectedBackgroundPathBrushCache; |
| 68 | + private Brush activeTabContentBackgroundBrushCache; |
| 69 | + |
60 | 70 | protected async override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs args)
|
61 | 71 | {
|
62 | 72 | NotCloseableTab.Visibility = Visibility.Collapsed;
|
@@ -409,6 +419,96 @@ private void ShortLongTextButton_Click(object sender, RoutedEventArgs e)
|
409 | 419 | FirstTab.Header = "s";
|
410 | 420 | LongHeaderTab.Header = "long long long long long long long long";
|
411 | 421 | }
|
| 422 | + |
| 423 | + private void HomeTabOverlapCheck_Click(object sender, RoutedEventArgs e) |
| 424 | + { |
| 425 | + var redBrush = new SolidColorBrush(); |
| 426 | + redBrush.Color = Colors.Red; |
| 427 | + BackgroundGrid.Background = redBrush; |
| 428 | + |
| 429 | + var tabBrush = new SolidColorBrush(); |
| 430 | + tabBrush.Color = Colors.Blue; |
| 431 | + SetFirstTabSelectedBackgroundPathFill(tabBrush); |
| 432 | + |
| 433 | + var contentBrush = new SolidColorBrush(); |
| 434 | + contentBrush.Color = Colors.Green; |
| 435 | + FirstTabContent.Background = contentBrush; |
| 436 | + } |
| 437 | + |
| 438 | + private void SetActiveTabTransparent_Click(object sender, RoutedEventArgs e) |
| 439 | + { |
| 440 | + var tabBrush = new SolidColorBrush(); |
| 441 | + tabBrush.Color = Colors.Transparent; |
| 442 | + SetFirstTabSelectedBackgroundPathFill(tabBrush); |
| 443 | + } |
| 444 | + |
| 445 | + private void SetActiveContentTransparent_Click(object sender, RoutedEventArgs e) |
| 446 | + { |
| 447 | + var contentBrush = new SolidColorBrush(); |
| 448 | + contentBrush.Color = Colors.Transparent; |
| 449 | + FirstTabContent.Background = contentBrush; |
| 450 | + } |
| 451 | + |
| 452 | + private void ClearOverlapCheck_Click(object sender, RoutedEventArgs e) |
| 453 | + { |
| 454 | + BackgroundGrid.Background = backgroundColorCache; |
| 455 | + |
| 456 | + if(activeTabSelectedBackgroundPathBrushCache != null) |
| 457 | + { |
| 458 | + FrameworkElement selectedBackgroundPath = FindFrameworkElementWithName("SelectedBackgroundPath", FirstTab); |
| 459 | + if(selectedBackgroundPath != null) |
| 460 | + { |
| 461 | + (selectedBackgroundPath as Path).Fill = activeTabSelectedBackgroundPathBrushCache; |
| 462 | + } |
| 463 | + } |
| 464 | + |
| 465 | + if(activeTabContentBackgroundBrushCache != null) |
| 466 | + { |
| 467 | + FirstTabContent.Background = activeTabContentBackgroundBrushCache; |
| 468 | + } |
| 469 | + } |
| 470 | + |
| 471 | + private void CacheFirstTabSelectedBackgroundPathFill() |
| 472 | + { |
| 473 | + FrameworkElement selectedBackgroundPath = FindFrameworkElementWithName("SelectedBackgroundPath", FirstTab); |
| 474 | + if(selectedBackgroundPath != null) |
| 475 | + { |
| 476 | + activeTabSelectedBackgroundPathBrushCache = (selectedBackgroundPath as Path).Fill; |
| 477 | + } |
| 478 | + } |
| 479 | + |
| 480 | + private void SetFirstTabSelectedBackgroundPathFill(Brush newBrush) |
| 481 | + { |
| 482 | + FrameworkElement selectedBackgroundPath = FindFrameworkElementWithName("SelectedBackgroundPath", FirstTab); |
| 483 | + if(selectedBackgroundPath != null) |
| 484 | + { |
| 485 | + (selectedBackgroundPath as Path).Fill = newBrush; |
| 486 | + } |
| 487 | + } |
| 488 | + |
| 489 | + private FrameworkElement FindFrameworkElementWithName(string name, DependencyObject startNode) |
| 490 | + { |
| 491 | + int count = VisualTreeHelper.GetChildrenCount(startNode); |
| 492 | + for (int i = 0; i < count; i++) |
| 493 | + { |
| 494 | + DependencyObject current = VisualTreeHelper.GetChild(startNode, i); |
| 495 | + if ((current.GetType()).Equals(typeof(FrameworkElement)) || (current.GetType().GetTypeInfo().IsSubclassOf(typeof(FrameworkElement)))) |
| 496 | + { |
| 497 | + FrameworkElement fe = (FrameworkElement)current; |
| 498 | + if(fe.Name == name) |
| 499 | + { |
| 500 | + return fe; |
| 501 | + } |
| 502 | + } |
| 503 | + var result = FindFrameworkElementWithName(name, current); |
| 504 | + if(result != null) |
| 505 | + { |
| 506 | + return result; |
| 507 | + } |
| 508 | + } |
| 509 | + return null; |
| 510 | + } |
| 511 | + |
412 | 512 | private void SetColorsButton_Click(object sender, RoutedEventArgs e)
|
413 | 513 | {
|
414 | 514 | var foregroundBrush = new SolidColorBrush();
|
|
0 commit comments