Bug 57360 - DataTrigger binding not working for bindings to parent Entry with {Binding Text}
Summary: DataTrigger binding not working for bindings to parent Entry with {Binding Text}
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: High minor
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-06-12 00:05 UTC by Mike Norman
Modified: 2017-06-28 14:03 UTC (History)
2 users (show)

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

repro project (338.02 KB, application/zip)
2017-06-14 16:23 UTC, Jimmy [MSFT]

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 57360 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:

Description Mike Norman 2017-06-12 00:05:39 UTC
With Xamarin.Forms, in the following XAML:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage    xmlns="http://xamarin.com/schemas/2014/forms"
    <StackLayout VerticalOptions="Center">
        <Label Text="Can you tell me the secret?" VerticalOptions="Center" HorizontalOptions="Center">
                <DataTrigger TargetType="Label"
                    Binding="{Binding Source={x:Reference checkEntry},
                    Value="The text color is green">
                    <Setter Property="TextColor" Value="Color.Green" />
        <Entry Placeholder="Type the secret here." x:Name="checkEntry" VerticalOptions="Center" HorizontalOptions="Center">
                <DataTrigger TargetType="Entry"
                    Binding="{Binding Source={x:Reference checkEntry},
                    <Setter Property="TextColor" Value="Red" />

...replace Binding="{Binding Source={x:Reference checkEntry}, Path=Text}" in the Entry markup with Binding="{Binding Text}".

The implicit binding to the parent control works, and the text color changes to red while the trigger condition is met. (For example, as page 867 of Petzold's Creating Mobile Apps with Xamarin.Forms indicates.)

Only the explicit binding, where the binding context is specified, works. iOS 7 simulator

Changing the XamlCompilationOptions value has no effect
Comment 1 Jimmy [MSFT] 2017-06-14 16:23:39 UTC
Created attachment 22888 [details]
repro project

I can see the issue described using the project I am attaching. I'm confirming the report so we can get a clarification from the engineers whether this is expected behavior or not.