Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

BindingMode.OneWayToSource, Value in View Model is null for View instance

$
0
0

Hi I am trying to implement a read only View (CustomRadioButton) from my view cell such that I can get a reference of my view (CustomRadioButton) inside my view cell, below is my code

In my viewcell constructor I have this after I initialize my CustomRadioButton

this.CustomRadioButton = this.customRadioButton;

and the following in my view cell class

public CustomRadioButton CustomRadioButton
        {
            get
            {
                return (CustomRadioButton)this.GetValue(CustomRadioButtonBindableProperty);
            }

            set
            {
                this.SetValue(CustomRadioButtonBindableProperty, value);
            }
        }

        public static readonly BindableProperty CustomRadioButtonBindableProperty =
            BindableProperty.Create(
                "CustomRadioButton",
                typeof(CustomRadioButton),
                typeof(MyCustomViewCell),
                default(View),
                BindingMode.OneWayToSource);

In my view model I have this:

public CustomRadioButton CustomRadioButton { get; set; }

Technically then if have an instance of a view model then I can get the view from within my view cell or does the property only work to source for properties such as those properties in my view itself like heights and text etc not an instance of itself?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>