maui icon indicating copy to clipboard operation
maui copied to clipboard

Fixed Custom Drawable does not support binding

Open NirmalKumarYuvaraj opened this issue 6 months ago • 3 comments
trafficstars

[!NOTE] Are you waiting for the changes in this PR to be merged? It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause

The BindingContext of the GraphicsView is not propagated to the Drawable object.

Description of Change

  • Added an override for OnBindingContextChanged in GraphicsView to ensure that the BindingContext of the Drawable object is updated when the BindingContext of the GraphicsView changes.

Public API Updates:

  • Updated the PublicAPI.Unshipped.txt files across various platforms (e.g., Android, iOS, macOS, Tizen, Windows, .NET Standard) to include the new OnBindingContextChanged override for GraphicsView.

Test Additions:

  • Added a new manual test case (Issue20991) to validate that custom IDrawable controls correctly support data binding. This test includes a GraphicsView with a bound Drawable object and a label describing the expected behavior.
  • Added an automated test for Issue20991 to verify that the GraphicsView's Drawable binding works as expected. The test uses Appium and NUnit to check for the presence of the label and validate the behavior via a screenshot.

Issues Fixed

Fixes #20991

NirmalKumarYuvaraj avatar May 12 '25 11:05 NirmalKumarYuvaraj

I think we want use BindableObject.SetInheritedBindingContext

@rmarinho , i have updated the code changes. please let me know if you have any concerns

NirmalKumarYuvaraj avatar May 14 '25 06:05 NirmalKumarYuvaraj

@NirmalKumarYuvaraj Could you rebase and fix the conflicts? Thanks in advance.

jsuarezruiz avatar Jun 17 '25 08:06 jsuarezruiz

@NirmalKumarYuvaraj Could you rebase and fix the conflicts? Thanks in advance.

@jsuarezruiz , i have rebased the branch. Please let me know if you have any concern.

NirmalKumarYuvaraj avatar Jun 17 '25 10:06 NirmalKumarYuvaraj