Bug 41136 - [iOS] Bound properties for Views not set yet when ViewInitialized is called.
Summary: [iOS] Bound properties for Views not set yet when ViewInitialized is called.
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-17 18:34 UTC by Jon Goldberger [MSFT]
Modified: 2016-11-07 01:01 UTC (History)
3 users (show)

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


Attachments
Test project (423.99 KB, application/zip)
2016-05-17 18:34 UTC, Jon Goldberger [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 41136 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 Jon Goldberger [MSFT] 2016-05-17 18:34:18 UTC
Created attachment 16022 [details]
Test project

## Description.

If I have a value bound to a View (Label, Button, etc.) in XAML, i.e. 
><local:MyLabel StyleId="{Binding UIAutomationID}" ... />

on Android, this property is set with the value of UIAutomationId from the view model when Forms.ViewInitialized is called, but is not set on iOS at this time.

## Steps to reproduce

1. open that attached test project (modified TipCalc).

2. Place a breakpoint in the ViewInitialized event handler on line 26, the Console.WriteLine statement.

3. Run the iOS app to a simulator.

4. When the breakpoint hits, examine the `label` variable.

Expected result: StyleId will be set to "BoundAutomationId"

Actual result: StyleId property is not set.

## Note 

This works on Android. If you do the same for the Android project you will see that StyleId is set by the time ViewInitialized is called. 

## Environment

Forms version 2.2.0.31. Also tested on Forms 2.3.0.58-pre2

=== Xamarin Studio Enterprise ===

Version 5.10.3 (build 51)
Installation UUID: ceaba76c-db06-4fbd-b326-f69ea53c3e01
Runtime:
	Mono 4.2.3 (explicit/832de4b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402030004

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.0.3.5 (Visual Studio Enterprise)
Android SDK: /Users/jongoldberger/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.3
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.Mac ===

Version: 2.4.2.1 (Visual Studio Enterprise)

=== Xamarin.iOS ===

Version: 9.6.1.9 (Visual Studio Enterprise)
Hash: 5f11db8
Branch: master
Build date: 2016-03-25 21:26:55-0400

=== Build Information ===

Release ID: 510030051
Git revision: f3c0d982165f785772d125f02668370d929014fb
Build date: 2016-03-24 18:51:31-04
Xamarin addins: ee5cfd3ecb6b20de47c1d25efb9a9abc101e8ce7
Build lane: monodevelop-lion-cycle6-c6sr3

=== Operating System ===

Mac OS X 10.11.5
Darwin Jons-MacBook-Pro.local 15.5.0 Darwin Kernel Version 15.5.0
    Tue Apr 19 18:36:36 PDT 2016
    root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Comment 1 adrianknight89 2016-11-07 01:01:43 UTC
I can confirm this issue, and it seems to be a binding issue. If you hard-code a value for the user=defined property, it works.