Bug 37071 - Dynamic binding is not working while setting the dynamic expando object to label TextProperty
Summary: Dynamic binding is not working while setting the dynamic expando object to la...
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-16 08:58 UTC by Dharmendar
Modified: 2016-09-06 12:50 UTC (History)
6 users (show)

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


Attachments
I have attached sample which can reproduce the reported issue. In that sample i have loaded a label and created a dynamic object.I have set the Label TextProperty as ExpandoObject using SetBinding. (294.01 KB, application/zip)
2015-12-16 09:08 UTC, Dharmendar
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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Dharmendar 2015-12-16 08:58:05 UTC
Dynamic binding is not working in Xamarin.Forms. I have created a dynamic expando object with one property “Name” and assigned value for the property. I have created a new label and bind the expando object to Label TextProperty through SetBinding method. Noted that the text will not display in Label.


Replication procedure:

1.	Create a sample
2.	Add a new Label
3.	Create a ExpandoObject and set a text value as a property for ExpandoObject 
4.	Binding the ExpandoObject property to Label TextProperty using SetBinding method
5.	Set the Label BindingContext as ExpandoObject
6.	Run the sample 
7.	Note that the text will not display in Label

Please refer the example code and also I have attached reproducible sample 



// App.cs

using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using Xamarin.Forms;

namespace DynamicSample
{
    public class App : Application
    {
        public App()
        {         
            Label label = new Label();

            // created a new Expando object and bind the TextProperty using Expando object
            dynamic newobj = new ExpandoObject();
            newobj.Name = "Hello World";
            label.BackgroundColor = Color.Pink;
            label.SetBinding(Label.TextProperty, "Name");
            label.BindingContext = newobj;

            // Added label as a child of Grid
            Grid mainLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand };
            mainLayout.RowDefinitions.Add(new RowDefinition());
            mainLayout.ColumnDefinitions.Add(new ColumnDefinition());
            mainLayout.Children.Add(label, 0, 0);

            MainPage = new ContentPage
            {
                Content = mainLayout
            };            
           
        }        
    }
}
Comment 1 Dharmendar 2015-12-16 09:08:43 UTC
Created attachment 14313 [details]
I have attached sample which can reproduce the reported issue. In that sample i have loaded a label and created a dynamic object.I have set the Label TextProperty as ExpandoObject using SetBinding.
Comment 2 Jason Smith [MSFT] 2016-02-11 03:50:59 UTC
This is a limitation of the Xamarin product without a JIT.
Comment 3 Andrey 2016-09-06 12:50:43 UTC
Any workarounds how to pass this limitation? As i get it it caused by the fact that JIT is not available on iOs? I tryied exclude iOs from target platforms in my PCL but no success...
Thank you