SearchBar command support

This commit is contained in:
NaBian committed 2019-03-24 15:22:39 +08:00
1 parent a92a3ce82d
commit 7c331c1e60
5 files changed
+84 -2

No files matched your search

@@ -0,0 +1,18 @@
using System;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel
{
public class SearchBarDemoViewModel : ViewModelBase
{
public RelayCommand<string> SearchCmd => new Lazy<RelayCommand<string>>(() =>
new RelayCommand<string>(Search)).Value;
private void Search(string key)
{
Growl.Info(key);
}
}
}
@@ -25,6 +25,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register<ChatBoxViewModel>();
SimpleIoc.Default.Register<CoverViewModel>();
SimpleIoc.Default.Register<DialogDemoViewModel>();
SimpleIoc.Default.Register<SearchBarDemoViewModel>();
}
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
@@ -54,6 +55,8 @@ namespace HandyControlDemo.ViewModel
public DialogDemoViewModel DialogDemo => ServiceLocator.Current.GetInstance<DialogDemoViewModel>();
public SearchBarDemoViewModel SearchBarDemo => ServiceLocator.Current.GetInstance<SearchBarDemoViewModel>();
#endregion
}
}