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

Bindings to Width and Height of a Control never stop triggering, even if size did not change at all. #22432

Closed
Picao84 opened this issue May 15, 2024 · 6 comments
Assignees
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Milestone

Comments

@Picao84
Copy link

Picao84 commented May 15, 2024

Description

I have a font size converter that takes a label width and height to adjust the font size using native code. Long after the font size has been set the converter keeps being triggered, as if the label width and height was changed, but its the exact same values as before.

This has only started happening from version 8.0.6 onwards on Android (iOS works perfectly fine). On a static screen this may not be noticeable but if you have animations (e.g. panels moving) they are very choppy. It can potentially lead to higher resource usage and low performance.

Steps to Reproduce

1 - Create a XAML page and add a label.

2 - Create an implementation of IMultiValueConverter.

3 - Add a multibinding to label for any property (e.g. Font Size) like this:

<Label.FontSize>
    <MultiBinding Converter="{StaticResource FontSizeConverter}">
         <Binding Source="{RelativeSource Self}" Path="Text"/>
         <Binding Source="{RelativeSource Self}" Path="Width"/>
         <Binding Source="{RelativeSource Self}" Path="Height"/>
    </MultiBinding>
</Label.FontSize>

4 - Put a breakpoint on on the IMultiValueConverter implementation Convert method and see it being triggered all the time.

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.6 SR1

Affected platforms

Android

Affected platform versions

Android 13 and Android 14

Did you find any workaround?

Unfortunately not.

Relevant log output

No response

@Picao84 Picao84 added the t/bug Something isn't working label May 15, 2024
Copy link
Contributor

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.

@PureWeen PureWeen added the s/needs-repro Attach a solution or code which reproduces the issue label May 15, 2024
@PureWeen
Copy link
Member

Possibly related
#22347

@Picao84
Copy link
Author

Picao84 commented May 15, 2024

It does sound a lot like what I'm seeing yes!

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels May 15, 2024
@mattleibow mattleibow added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter and removed s/needs-attention Issue has more information and needs another look labels May 15, 2024
@mattleibow mattleibow modified the milestones: Backlog, .NET 8 SR6 May 15, 2024
@mattleibow mattleibow moved this from Todo to In Progress in MAUI SDK Ongoing May 15, 2024
@PureWeen
Copy link
Member

Can you test with the latest nightly build?
https://github.com/dotnet/maui/wiki/Nightly-Builds

@PureWeen PureWeen added the s/needs-info Issue needs more info from the author label May 16, 2024
@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels May 18, 2024
@Picao84
Copy link
Author

Picao84 commented May 18, 2024

The latest nightly build seems to have fixed this issue. Unfortunately it created other issues like custom fonts not working at all and border corner radius not working when set from code... sigh.

@PureWeen
Copy link
Member

The latest nightly build seems to have fixed this issue. Unfortunately it created other issues like custom fonts not working at all and border corner radius not working when set from code... sigh.

Can you please log issues for these so we can fix ASAP?

The border issue might be fixed by
#22558

@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing May 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants