microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.38k stars 683 forks source link

[WINUI] Binding not works properly when bind a Nullable property. #9435

Open SaranRajChandrasekaran opened 8 months ago

SaranRajChandrasekaran commented 8 months ago

Describe the bug

Binding does not work properly when binding the nullable int property to the nullable double property. When changing the value in run time, the changed value isn't set to the binded nullable property it throws an error. Below I mentioned the error.

Error: Cannot save value from target back to source. BindingExpression: Path='NullableInt' DataItem='WinUI_CustomControl.ViewModel'; target element is 'WinUI_CustomControl.CustomControl1' (Name='null'); target property is 'Value' (type 'Object').

Note: When binding the Nullable double property it works properly.

This issue only occurs on the WinUI platform, but on the WPF platform, it works fine.

WinUI_CustomControl.zip

Steps to reproduce the bug

  1. Run the custom control.
  2. Edit the value in the TextBox, the changed value is set properly to the integer binded value but in the nullable integer binded value doesn't set properly.

Expected behavior

The edited value should be set properly to the nullable integer binding value.

Screenshots

https://github.com/microsoft/microsoft-ui-xaml/assets/102651874/6ce4e571-830e-4232-a279-d6ae1ce8860b

NuGet package version

WinUI 3 - Windows App SDK 1.5.1: 1.5.240311000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

github-actions[bot] commented 8 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. Thank you!

Open similar issues:

Closed similar issues:

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

SreemonPremkumarMuthukrishnan commented 7 months ago

Hi Team,

Is there any update?