From 3ce0e701e32903d4c4572ef8421acbe147d4c103 Mon Sep 17 00:00:00 2001 From: Aivaras Varnas Date: Wed, 22 May 2019 15:30:49 +0300 Subject: [PATCH] Fix for PositionSelectedCommand bindable property to accept custom command implementations i.e Prism --- .gitignore | 6 +++++- .../CarouselViewControl.cs | 7 ++++--- Demo/MainViewModel.cs | 2 +- iOS/Demo.iOS.csproj | 7 +++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6ae0b86..24fc077 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,8 @@ iOS/obj UWP/bin UWP/obj packages -*.userprefs \ No newline at end of file +*.userprefs +/.vs/CarouselView +/CarouselView/CarouselView.FormsPlugin.Abstractions.Portable/bin/Debug +/CarouselView/CarouselView.FormsPlugin.Abstractions.Portable/obj/Debug +/Droid/Demo.Droid.csproj.user diff --git a/CarouselView/CarouselView.FormsPlugin.Abstractions/CarouselViewControl.cs b/CarouselView/CarouselView.FormsPlugin.Abstractions/CarouselViewControl.cs index 9d9ff10..339e313 100644 --- a/CarouselView/CarouselView.FormsPlugin.Abstractions/CarouselViewControl.cs +++ b/CarouselView/CarouselView.FormsPlugin.Abstractions/CarouselViewControl.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Collections.Generic; using System.ComponentModel; +using System.Windows.Input; namespace CarouselView.FormsPlugin.Abstractions { @@ -134,14 +135,14 @@ public float ArrowsTransparency set { SetValue(ArrowsTransparencyProperty, value); } } - public static readonly BindableProperty PositionSelectedCommandProperty = BindableProperty.Create("PositionSelectedCommand", typeof(Command), typeof(CarouselViewControl), null, BindingMode.Default, (bindable, value) => + public static readonly BindableProperty PositionSelectedCommandProperty = BindableProperty.Create("PositionSelectedCommand", typeof(ICommand), typeof(CarouselViewControl), null, BindingMode.Default, (bindable, value) => { return true; }); - public Command PositionSelectedCommand + public ICommand PositionSelectedCommand { - get { return (Command)GetValue(PositionSelectedCommandProperty); } + get { return (ICommand)GetValue(PositionSelectedCommandProperty); } set { SetValue(PositionSelectedCommandProperty, value); } } diff --git a/Demo/MainViewModel.cs b/Demo/MainViewModel.cs index a1e5b61..c1d6a5a 100644 --- a/Demo/MainViewModel.cs +++ b/Demo/MainViewModel.cs @@ -38,7 +38,7 @@ public ObservableCollection MyItemsSource { } } - public Command MyCommand { protected set; get; } + public ICommand MyCommand { protected set; get; } protected virtual void OnPropertyChanged(string propertyName) { diff --git a/iOS/Demo.iOS.csproj b/iOS/Demo.iOS.csproj index b446fd5..ca7eab7 100644 --- a/iOS/Demo.iOS.csproj +++ b/iOS/Demo.iOS.csproj @@ -29,7 +29,8 @@ true iPhone Developer: Alexander Reyes (T3VKUDC3C3) true - + + full @@ -106,7 +107,7 @@ - false + false @@ -126,6 +127,8 @@ {D525F236-6A2D-4010-B1CC-4A4B8581C90B} CarouselView.FormsPlugin.iOS + false + false {36E4C107-3B10-4DC6-8E6A-BA251DC3BAF3}