Bug 32921 - Property Binding Ignoring ViewModel's Property Changed Event
Summary: Property Binding Ignoring ViewModel's Property Changed Event
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-10 14:07 UTC by Jimmy [MSFT]
Modified: 2017-06-28 08:02 UTC (History)
7 users (show)

Tags: ac WP NGF
Is this bug a regression?: ---
Last known good build:


Attachments
Repro project (264.67 KB, application/zip)
2015-08-10 14:07 UTC, Jimmy [MSFT]
Details
repro project (284.97 KB, application/zip)
2015-08-18 20:04 UTC, Jimmy [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 32921 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Jimmy [MSFT] 2015-08-10 14:07:46 UTC
Created attachment 12435 [details]
Repro project

*** Overview ***
On WP and iOS, a Grid and Button that has their IsVisible property bound to a view model is not receiving or not responding to the property changed event. The event is fired, but the button does not appear. 

This seems to work on Android however. The Android project is included in the attached solution.


*** Steps to Reproduce ***
1. Run the attached repro project on WP
2. Select an item in the list


*** Actual Results ***
The list item is shown as being selected, but no button appears.


*** Expected Results ***
Selecting the item causes the button to appear within the same cell.


*** Environment Info ***
Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Team Explorer for Visual Studio 2013   06177-004-0444002-02323
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02323
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02323
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02323
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02323
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02323
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0444002-02323
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

Common Azure Tools   1.4
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Multilingual App Toolkit   3.1.1250.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

NuGet Package Manager   2.8.60610.756
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin   3.11.666.0 (ebae43a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.2.0 (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 1 Jimmy [MSFT] 2015-08-18 20:04:44 UTC
Created attachment 12565 [details]
repro project

Turns out it _does_ work on iOS. I made an error in the project so it looked like it hadn't appear even though it had.

Still does not work on WP however, even on Forms 1.5-pre1. I've updated the report with a simpler to follow test case. Same steps to reproduce as before:

1. Run the attached repro project on WP
2. Select an item in the list
Comment 2 Paul DiPietro [MSFT] 2015-08-19 16:53:13 UTC
Seems to be behaving this way in WP as you describe.
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-25 02:32:10 UTC
I tried a few quick little sanity tests to satisfy my curiosity on this bug.


The results are nothing too surprising, but maybe still somewhat helpful for the further investigation of the bug.


- The problem is not dependent on the fact that the `IsVisible` property is bound, but rather just that the initial value is `false`.



- (Partial workaround attempts) If you change `ShowButton = false` to `ShowButton = true` in the `TestItem()` constructor, the buttons all appear as expected at the start. They then disappear and reappear correctly after that. Unfortunately, the trick I've used as a workaround for a couple similar issues in the past doesn't work here. (In particular, setting `ShowButton` to `false` in a `TestPage.LayoutChildren()` override method does not stop the problem. Apparently that's still too early in the rendering process. Setting `ShowButton` to `false` when the `ItemAppearing` event fires for a particular item _does_ work correctly. So hiding the buttons using an `ItemAppearing` event handler that self-unsubscribes could be used as a partial workaround, but note this technique causes the buttons to appear very briefly on screen before they are hidden.)



- When the button starts with `IsVisible = false`, the underlying native `System.Windows.Controls.Button` controls do not change correctly after `IsVisible` is set to `true`. For example:

a. The "ActualWidth" and "ActualHeight" both remain 0.

b. The "Visibility" remains "Collapsed".




Brendan
Xamarin Customer Support