void UpdateAppearance(ShellAppearance appearance) { var tabBarBackgroundColor = ShellRenderer.DefaultBackgroundColor; var tabBarForegroundColor = ShellRenderer.DefaultForegroundColor; var titleColor = ShellRenderer.DefaultTitleColor; if (appearance != null) { var a = (IShellAppearanceElement)appearance; tabBarBackgroundColor = a.EffectiveTabBarBackgroundColor.ToWindowsColor(); tabBarForegroundColor = a.EffectiveTabBarForegroundColor.ToWindowsColor(); if (!appearance.TitleColor.IsDefault()) { titleColor = appearance.TitleColor.ToWindowsColor(); } } _BottomBarArea.Background = _HeaderArea.Background = new UwpSolidColorBrush(tabBarBackgroundColor); _Title.Foreground = new UwpSolidColorBrush(titleColor); var tabbarForeground = new UwpSolidColorBrush(tabBarForegroundColor); foreach (var button in _BottomBar.Children.OfType <AppBarButton>()) { button.Foreground = tabbarForeground; } if (SectionRenderer is IAppearanceObserver iao) { iao.OnAppearanceChanged(appearance); } }
protected override void UpdateBackgroundColor() { base.UpdateBackgroundColor(); if (GetValue(BackgroundProperty) == null && Children.Count == 0) { // Forces the layout to take up actual space if it's otherwise empty Background = new WSolidColorBrush(Colors.Transparent); } }
void MakeInputVisible(Brush?background) { // If we aren't input transparent, we don't need the background layer hack RemoveBackgroundLayer(); if (background == null) { // We can't have a null background, because that would allow input through // So we'll make the background color transparent (visually the same as null, but consumes input) background = new WSolidColorBrush(UI.Colors.Transparent); } Background = background; }
void UpdateAppearance(ShellAppearance appearance) { var tabBarBackgroundColor = ShellView.DefaultBackgroundColor; var tabBarForegroundColor = ShellView.DefaultForegroundColor; var titleColor = ShellView.DefaultTitleColor; if (appearance != null) { var a = (IShellAppearanceElement)appearance; if (a.EffectiveTabBarBackgroundColor != null) { tabBarBackgroundColor = a.EffectiveTabBarBackgroundColor.ToWindowsColor(); } if (a.EffectiveTabBarForegroundColor != null) { tabBarForegroundColor = a.EffectiveTabBarForegroundColor.ToWindowsColor(); } if (!appearance.TitleColor.IsDefault()) { titleColor = appearance.TitleColor.ToWindowsColor(); } } _HeaderArea.Background = new UwpSolidColorBrush(tabBarBackgroundColor); // Only color the bottom area if there are tabs present if (ShellItem?.Items.Count > 1) { _BottomBarArea.Background = new UwpSolidColorBrush(tabBarBackgroundColor); } _Title.Foreground = new UwpSolidColorBrush(titleColor); var tabbarForeground = new UwpSolidColorBrush(tabBarForegroundColor); foreach (var button in _BottomBar.Children.OfType <AppBarButton>()) { button.Foreground = tabbarForeground; } if (SectionView is IAppearanceObserver iao) { iao.OnAppearanceChanged(appearance); } }
public object Convert(object value, Type targetType, object parameter, string language) { WSolidColorBrush brush = null; var element = value as FrameworkElement; if (element != null) { while (brush == null && element != null) { DependencyProperty property = GetBackgroundProperty(element); if (property != null) { value = element.GetValue(property); brush = value as WSolidColorBrush; if (brush != null && brush.Color == Colors.Transparent) { brush = null; } } element = VisualTreeHelper.GetParent(element) as FrameworkElement; } } brush = value as WSolidColorBrush; if (brush != null) { Maui.Graphics.Color color = brush.ToFormsColor(); double delta = Shift; if (color.GetLuminosity() > .6) { delta = -Shift; } color = color.AddLuminosity((float)delta); return(new WSolidColorBrush(color.ToWindowsColor())); } return(null); }