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.19k stars 1.75k forks source link

Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics warnings are displayed for setting binding to TextProperty for Entry control #24120

Open manojSF3414 opened 2 months ago

manojSF3414 commented 2 months ago

Description

While debugging the applications, I found a warning while setting the binding for the TextProperty of the Entry control. The warning indicates that the class in which we have the property doesn't contain the property we used to bind. We are using a custom Entry with custom classes. For simpler replication, we have tried to replicate this issue with the Entry control directly, and we were able to create the warning in that simpler sample too.

The binding is working fine, but I was able to receive multiple warnings due to this same issue.

Steps to Reproduce

  1. Open the application
  2. Run the application on either Android or Windows platforms
  3. You will be able to observe the warning "Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: 'PageNumber' property not found on 'SampleMAUI.MainPage', target property: 'Microsoft.Maui.Controls.Entry.Text'" on the output window

Link to public reproduction project repository

https://github.com/manojSF3414/SampleMAUI

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Android 14, Windows 10.0.19041.0

Did you find any workaround?

No.

Relevant log output

[0:] Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: 'PageNumber' property not found on 'SampleMAUI.MainPage', target property: 'Microsoft.Maui.Controls.Entry.Text'
github-actions[bot] commented 2 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.

PureWeen commented 2 months ago

@simonrozsival @StephaneDelcroix @mgoertz-msft ?

mgoertz-msft commented 2 months ago

That comes from the runtime and not IntelliSense, so @StephaneDelcroix would probably know best. @spadapet may also have an idea.

spadapet commented 2 months ago

I tried this out, here are my notes:

So I don't think there's a bug in the binding code, the error message just doesn't clearly spell out all of the restrictions: a public property with both a getter and setter is required for a two-way binding. A field will not work.

shugaoye commented 2 months ago

I created a .NET MAUI app template which can be found at here. There is the same issue in the list view. The source code can be found at here.