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

Set method not execute BindableProperty

$
0
0

Hi!

I create a Bindable property to pass a data array:

    public static readonly BindableProperty ItemsProperty = BindableProperty.Create(
                "Items",
                typeof(IList<JobObject>),
                typeof(JobStack));

public IList<JobObject> Items
        {
            get
            {
                CreateJobTemplates();
                return (IList<JobObject>)GetValue(ItemsProperty);
            }
            set => SetValue(ItemsProperty, value);
        }

Or i tried this one:

       private IList<JobObject> _items;
            public IList<JobObject> Items
            {
                get => _items;
                set
                {
                    _items = value;

                    CreateJobTemplates();
                    OnPropertyChanged();
                }
            }

But the set method does not hold if any view in Xaml is not bound to this BindableProperty.
How can i pass data array using BindableProperty? I need to execute the method **CreateJobTemplates(); **after I assigned the ItemsProperty.


Viewing all articles
Browse latest Browse all 77050

Trending Articles