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

How to notify or call viewmodel 's method from customview 's bindable property

$
0
0

Hi All, I need to call viewmodel method from customview whenever bindable property changed.

public class CustomPieChart : SupportPieChartExtended
{
public static readonly BindableProperty SelectedValueProperty = BindableProperty.Create(nameof(SelectedValue), typeof(string), typeof(CustomPieChart), null);
public string SelectedValue
{
get { return (string)GetValue(SelectedValueProperty); }
set { SetValue(SelectedValueProperty, value);

        }
    }

}

I am setting this value from customrenderer of CustomPiechart which I am able to but I need to call a method of viewmodel .

public class PaySlipPageViewModel : BaseViewModel
{
public string SelectedValuesSet
{
get => selectedValuesSet;
set {
SetProperty(ref selectedValuesSet, value);
Hello();}
}

public void Hello(){
{
Console.WriteLine("Hello");
}
}

In the UI

I need to reflect SelectedValuesSet from CustomPieChart Class whenever SelectedValue changed.

Please help


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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