Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToolBar Overflow Button background #3694

Open
WarpSpeed99 opened this issue Oct 14, 2024 · 2 comments
Open

ToolBar Overflow Button background #3694

WarpSpeed99 opened this issue Oct 14, 2024 · 2 comments
Labels
enhancement evaluation required Items is pending review or evaluation by the team

Comments

@WarpSpeed99
Copy link

Hello everybody, this is my first feature request so please be kind if I am writing something stupid.

I have noticed that in using the ToolBar, if I change the background the overflow button background does not change because in the style definition, the background property (for both vertical and horiziontal overflow buttons) is defined as

<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Background}" />

A workaround to this is to define this property as

<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource AncestorType=ToolBar}}" />

In this way, any background colo I will set to the toolbar (or if I do not explicitly set one) the overflow button background will be "consistent" with the rest of the toolbar.

I hope that what I am requested is not stupid (and in this case I apologize).

thanks in advance for Your attention
Kind Regards
Fabio

@WarpSpeed99 WarpSpeed99 added enhancement evaluation required Items is pending review or evaluation by the team labels Oct 14, 2024
@corvinsz
Copy link
Contributor

@WarpSpeed99 with my limited experience using ToolBars, I'm questioning if this is the right change. Especially because it would be a visual breaking change for everyone else.

If I understand your problem correctly, you can just set the Background of your ToggleButton to Transparent and be done with it.
It would look something like this:

<ToolBar Background="Fuchsia">
  <ToggleButton Margin="10"
                Style="{StaticResource MaterialDesignToolBarVerticalOverflowButtonStyle}"
                Background="Transparent"/>
  <ToggleButton Margin="10" Style="{StaticResource MaterialDesignToolBarHorizontalOverflowButtonStyle}"/>
</ToolBar>

Result:
image

For mass-applying this change you could consider defining a global style for ToggleButton in your App.xaml which sets the Background="Transparent".

@WarpSpeed99
Copy link
Author

Hi @corvin, thanks for your fast replay. What you suggest is clear and a very good advise, but maybe I was unable to explain my issue. In your example you define a custom ToggleButton which is not the one that automatically comes in the ToolBar control (and for which I tried to redefine the background using custom styles but I didn't succeed). I'll try to be more precise but I have to be longer and I apologize for that. In the following pictures You'll see the toolbar in two different configurations; the first one (NOMINAL) is the nominal definition of the ToolBar in material design in xaml 5.1.0, while the second one (MODIFIED) is with my "modification".

NOMINAL

I have tested the ToolBar in both Dark and Light base theme (using a "BlueGrey" primary color and an "Orange" secondary color) with default toolbar background and with a custom toolbar background:

Dark base theme, default background

<ToolBarTray Grid.Row="0">
    <ToolBar ClipToBounds="False" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>

in this case everything is ok as you can see from the picture below

Capture01

Light base theme, default background

<ToolBarTray Grid.Row="0">
    <ToolBar ClipToBounds="False" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>

also in this case everything is ok as you can see from the picture below

Capture02

Dark base theme, custom background

<ToolBarTray Grid.Row="0 Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}">
    <ToolBar ClipToBounds="False" Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>

in this case, as You can see from the picture below, all the toolbar is keeping the custom background color except for the Overflow Button

Capture03

Light base theme, custom background

<ToolBarTray Grid.Row="0 Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}">
    <ToolBar ClipToBounds="False" Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>

also in this case, as You can see from the picture below, all the toolbar is keeping the custom background color except for the Overflow Button

Capture04

MODIFIED

I have replicated the four situations above, using a modified version of the library with the "modification" and here are the results:

Dark base theme, default background

<ToolBarTray Grid.Row="0">
    <ToolBar ClipToBounds="False" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>
Capture05

Light base theme, default background

<ToolBarTray Grid.Row="0">
    <ToolBar ClipToBounds="False" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>
Capture06

Dark base theme, custom background

<ToolBarTray Grid.Row="0 Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}">
    <ToolBar ClipToBounds="False" Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>
Capture07

Light base theme, custom background

<ToolBarTray Grid.Row="0 Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}">
    <ToolBar ClipToBounds="False" Background="{DynamicResource MaterialDesign.Brush.Primary.Dark}" Style="{DynamicResource MaterialDesignToolBar}">
       ...
       some buttons to fill the toolbar
       ...
    </ToolBar>
</ToolBarTray>
Capture08

I apologie again for the very very long post, but I hope that my issue is now clear. I also apologize if (and due to the fact tha I am not an expert it is highly probable) I didn't understand that what I want Achieve cna be done easily without modify the library (or worst, break it).

Thanks to all for the patioence
Kind Regards
Fabio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement evaluation required Items is pending review or evaluation by the team
Projects
None yet
Development

No branches or pull requests

2 participants