dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.06k stars 1.73k forks source link

Icon Button in ToolBar does not change the Size In Windows Plarform #22210

Open solrac3f opened 5 months ago

solrac3f commented 5 months ago

Description

The ToolbarItem class comes with an IconImageSource property, which is of type ImageSource. This means that we can also use a FontImageSource to provide a icon for the button based on a custom font. The Icon Button can be created, but in Windows Machine Platform the Size of the Icon does not change depending on the value. I tried out in Android and there Size changes. The problem looks like appears only if we use the Icon Button inside the Toolbar. If we use the same approach outside the Toolbar the size of the icon change.

Follows example code:

` <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MauiApp1.MainPage">

<ContentPage.ToolbarItems>

    <ToolbarItem Text="Second Page"
                 Clicked="GotoSecondPage" />

    <ToolbarItem Clicked="GotoSecondPage">
        <ToolbarItem.IconImageSource>
            <FontImageSource FontFamily="MaterialIconsOutlined-Regular"
                             Glyph="&#xe5e1;"
                             Color="Black"
                             Size="50" />
        </ToolbarItem.IconImageSource>
    </ToolbarItem>

</ContentPage.ToolbarItems>

<Shell.TitleView>
    <HorizontalStackLayout VerticalOptions="Fill">
        <Label Text="Welcome to MAUI"
               FontFamily="Strande2"
               TextColor="White"
               VerticalTextAlignment="Center"
               VerticalOptions="Center"
               HeightRequest="50"
               FontSize="30" />
    </HorizontalStackLayout>
</Shell.TitleView>

<ScrollView>
    <VerticalStackLayout Padding="30,0"
                         Spacing="15">
        <Label Text="HOME PAGE"
               Style="{StaticResource Headline}"
               SemanticProperties.HeadingLevel="Level1" />
        <Image Source="dotnet_bot.png"
               HeightRequest="130"
               Aspect="AspectFit"
               SemanticProperties.Description="dot net bot in a race car number eight" />

        <Label Text="Hello, World!"
               Style="{StaticResource Headline}"
               SemanticProperties.HeadingLevel="Level1" />

        <Button x:Name="CounterBtn"
                Text="Click me"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Fill" />

        <ImageButton Clicked="OnCounterClicked"
                     BackgroundColor="Transparent"
                     HorizontalOptions="Fill"
                     VerticalOptions="Fill">
            <ImageButton.Source>
                <FontImageSource FontFamily="MaterialIconsOutlined-Regular"
                                 Glyph="&#xe87d;"
                                 Color="Black"
                                 Size="90" />
            </ImageButton.Source>
        </ImageButton>

        <Button x:Name="GoToPageTwoButton"
                Text="Go to Page Two"
                Clicked="GotoSecondPage"
                HorizontalOptions="Fill" />
    </VerticalStackLayout>
</ScrollView>

` Untitled

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 5 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Zhanglirong-Winnie commented 5 months ago

Verified this issue with Visual Studio 17.10 Preview 6.0 (8.0.7 & 8.0.21). Can repro on windows platform.