This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 22720 - Add support for TargetNullValue and FallbackValue in XAML bindings
Summary: Add support for TargetNullValue and FallbackValue in XAML bindings
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.2.2
Hardware: All All
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-06 12:15 UTC by Jérémie Di Prizio
Modified: 2017-02-15 08:12 UTC (History)
12 users (show)

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


Attachments

Description Jérémie Di Prizio 2014-09-06 12:15:11 UTC
At the moment, using either TargetNullValue or FallbackValue in a XAML binding raises a TargetInvocationException which leads me to believe that neither of these properties are implemented (seems to be confirmed by your API reference).

Would be great if they were implemented as setting those fallback/replacement values in the view model code is a bit noisy.

For reference here are the MSDN pages of those properties:

TargetNullValue: http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.targetnullvalue(v=vs.110).aspx
FallbackValue: http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.fallbackvalue(v=vs.110).aspx
Comment 1 Arpit Jha 2014-09-08 05:53:21 UTC
I have checked this issue with some XAML binding and unable to reproduce it.

Could you please provide us sample project/Steps to reproduce ,build and Environment info also ,So that i can able to check at our end.
Comment 2 Bojan Panjevic 2014-12-11 00:08:31 UTC
I'm also able to confirm the issue. Here is a part of the XAML

 <DataTemplate x:Key="ProfileItemTemplate">
        <ViewCell>
          <ViewCell.View>
            <StackLayout Orientation="Vertical" Padding="10,0,10,0" HorizontalOptions="Fill">
              <Label Text="{Binding Description}" Font="Large" HorizontalOptions="Fill"/>
              <StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand">
                <Entry Text="{Binding Text}" VerticalOptions="Center" WidthRequest="350"
                       IsVisible="{Binding IsTextRequired}" />
                <Switch VerticalOptions="Center"
                  IsVisible="{Binding IsTextRequired, Converter={StaticResource InvertBooleanConverter }}"
                  IsToggled="{Binding IsChecked, TargetNullValue=False}}"/>
              </StackLayout>
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
Comment 3 Olivier Ansquer 2016-01-22 20:15:09 UTC
These properties are important and it should not be difficult to add. Why so long? Do you have a simple alternative solution?
Comment 4 Jason Smith 2016-03-16 12:34:42 UTC
The request got set to NEEDS INFO somehow (looks like the triager got confused) and the feature request never made it to the dev team. Im digging through the backlog now trying to find everything and just ran across this.

Its now added to the feature board.
Comment 5 Sascha Schwegelbauer 2016-10-02 13:20:06 UTC
Status: RESOLVED FEATURE ?!

-> It's not present in current 2.3.1.114
Comment 6 Jason Smith 2017-02-14 19:40:19 UTC
This is not on our current roadmap.
Comment 7 JeremyH 2017-02-14 20:19:35 UTC
So after almost 3 years, for such a basic feature:

1. "triager got confused, Its now added to the feature board."

2. "This is not on our current roadmap"

I honestly haven't experienced any library vendor worse than Xamarin.
Comment 8 Olivier Ansquer 2017-02-15 08:12:57 UTC
+1 for JeremyH's answer. This type of response is incomprehensible on such a simple evolution.

Note You need to log in before you can comment on or make changes to this bug.