public BaseSideBarViewModel(IEnumerable <T> collection, SideBarConfiguration <T> configuration = default(SideBarConfiguration <T>)) { Configuration = configuration; Items = collection.ToObservable(); if (Configuration != null) { CreateNewCommand = new BaseCommand(o => { Configuration.NewAction(o); Refresh(); }, o => !Items?.Any(item => item.Id == 0) ?? true); DeleteCommand = new BaseCommand(Configuration.DeleteAction, o => !SelectedItemIsNull); ImportCommand = new BaseCommand(Configuration.ImportAction); ExportCommand = new BaseCommand(Configuration.ExportAction); CreateFromCommand = new BaseCommand(Configuration.CreateFromAction); SelectCommand = new BaseCommand(Configuration.SelectAction); if (Configuration.ItemDoubleClickAction != null) { ItemMouseDoubleClickCommand = new BaseCommand(Configuration.ItemDoubleClickAction); } ClearCommand = new BaseCommand(Configuration.ClearAction); EnterKeyPressedCommand = new BaseCommand(Configuration.EnterKeyPressedAction); IsFilterTextFocused = Configuration.IsFilterTextFocusedOnStart; } }
public SideBarViewModel(IEnumerable <T> collection, SideBarConfiguration <T> configuration = null) : base(collection, configuration) { }