completed the branch
This commit is contained in:
1 parent
ae36827885
commit
0d91919b14
5 files changed
+106
-14
No files matched your search
@@ -1,13 +1,50 @@
|
||||
using HandyControlDemo.Data;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class TagDemoViewModel : DemoViewModelBase<DemoDataModel>
|
||||
public class TagDemoViewModel : ViewModelBase
|
||||
{
|
||||
public TagDemoViewModel(DataService dataService)
|
||||
{
|
||||
DataList = dataService.GetDemoDataList(10);
|
||||
DataList = new ObservableCollection<DemoDataModel>(dataService.GetDemoDataList(10));
|
||||
}
|
||||
|
||||
public ObservableCollection<DemoDataModel> DataList { get; set; }
|
||||
|
||||
private string _tagName;
|
||||
|
||||
public string TagName
|
||||
{
|
||||
get => _tagName;
|
||||
#if NET40
|
||||
set => Set(nameof(TagName), ref _tagName, value);
|
||||
#else
|
||||
set => Set(ref _tagName, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(TagName))
|
||||
{
|
||||
Growl.Warning(Lang.PlsEnterContent);
|
||||
return;
|
||||
}
|
||||
|
||||
DataList.Insert(0, new DemoDataModel
|
||||
{
|
||||
IsSelected = DataList.Count % 2 == 0,
|
||||
Name = TagName
|
||||
});
|
||||
TagName = string.Empty;
|
||||
})).Value;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public SplitButtonDemoViewModel SplitButtonDemo => SimpleIoc.Default.GetInstance<SplitButtonDemoViewModel>();
|
||||
|
||||
public TagDemoViewModel TagDemo => SimpleIoc.Default.GetInstance<TagDemoViewModel>();
|
||||
public TagDemoViewModel TagDemo => new TagDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user