Create Helper class named ListViewBehaviours ------------------------------- ListViewBehaviours.cs public class ListViewBehaviours : Behavior<ListView> { public static readonly BindableProperty CommandProperty = BindableProperty.Create( propertyName: "Command", returnType: typeof(ICommand), declaringType: typeof (ListViewBehaviours)); public ICommand Command { get { return (ICommand)GetValue(CommandProperty); } set { SetValue(CommandProperty, value); } } protected override void OnAttachedTo(ListView bindable) { base.OnAttachedTo(bindable); bindable.ItemSelected += Bindable_ItemSelected; bindable.BindingContextChanged += Bindable_BindingContextChanged; } private void Bindable_BindingContextChanged(object sender, EventArgs e) { var lv = sender as ListView; BindingContext = lv?.BindingContext; } private void Bindable_ItemSelected(object sender, SelectedItemChangedEv...
Comments
Post a Comment