Bug 48554 - Bound static property does not call setter in custom view
Summary: Bound static property does not call setter in custom view
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-12-01 16:38 UTC by Dale Cebula
Modified: 2016-12-16 11:42 UTC (History)
5 users (show)

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


Attachments
Test project which recreates the static binding issue (224.46 KB, application/x-zip-compressed)
2016-12-01 16:38 UTC, Dale Cebula
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:
VERIFIED FIXED

Description Dale Cebula 2016-12-01 16:38:22 UTC
Created attachment 18741 [details]
Test project which recreates the static binding issue

Tested on iOS and Android.

Custom control with the following property creates a System.NullReferenceException when bound to a static property in Xaml. The setter does not appear to be called.


        public static readonly BindableProperty ValuesProperty =
            BindableProperty.Create(nameof(Values), typeof(List<string>), typeof(MoonRangeSlider), null);

        public List<string> Values
        {
            get { return (List<string>)GetValue(ValuesProperty); }
            set { SetValue(ValuesProperty, value); }
        }


This Xaml causes a System.NullReferenceException. This works prior to 2.3.3.168

    <moonui:MoonRangeSlider
           Grid.Row="3"
           NotchHeight="12"
           x:Name="SliderGrades"
           Values="{x:Static moonviews:GradeView.All}"
           HeightRequest="50"
           BackgroundColor="#FFe6e6e6" />

Rolling back to Version 2.3.2.127 works as it always has on both iOS and Android.

Test project attached.
Comment 1 Stephane Delcroix 2016-12-01 21:00:59 UTC
https://github.com/xamarin/Xamarin.Forms/pull/566
Comment 2 Samantha Houts [MSFT] 2016-12-02 00:33:40 UTC
Should be fixed in 2.3.3-SR1. Thank you!
Comment 3 Parmendra Kumar 2016-12-16 11:42:50 UTC
I have checked this issue with Xamarin.Forms 2.3.3.175 and observed that this issue has been fixed.


Hence closing this issue.