using System;
using System.Collections.Generic;
using System.Linq;
-
+using System.Windows.Input;
using NUnit.Framework;
namespace Xamarin.Forms.Core.UnitTests
Assert.True (searchBar.IsEnabled);
}
+
+ class MyCommand : ICommand
+ {
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+
+ public void Execute(object parameter)
+ {
+ }
+
+ public event EventHandler CanExecuteChanged;
+ }
+
+ [Test]
+ public void DoesNotCrashWithNonCommandICommand()
+ {
+ var searchBar = new SearchBar();
+ Assert.DoesNotThrow(() => searchBar.SearchCommand = new MyCommand());
+ }
}
}
static void OnCommandChanged(BindableObject bindable, object oldValue, object newValue)
{
var self = (SearchBar)bindable;
- var newCommand = (Command)newValue;
- var oldCommand = (Command)oldValue;
+ var newCommand = (ICommand)newValue;
+ var oldCommand = (ICommand)oldValue;
if (oldCommand != null)
{