Наследование: ViewModel, ICommand
        public MultipleValuedDataModelPropertyViewModel(Func <TPropertyType> appendValue, Action <int> elementRemovedAt, IEnumerable <TPropertyType> values, string caption)
        {
            _appendValue      = appendValue;
            _elementRemovedAt = elementRemovedAt;

            _values = new ObservableCollection <TPropertyType>(values ?? new TPropertyType[0]);
            Values  = new ReadOnlyObservableCollection <TPropertyType>(_values);

            AddElementCommand      = new CommandViewModel(OnAddElementCommand, "Add");
            RemoveElementAtCommand = new CommandViewModel(OnRemoveElementAtCommand, "Remove");

            Caption = caption;
        }
Пример #2
0
        public TreeElementViewModel(ApplicationViewModel application, string name, TreeElementType? treeElementType = null)
        {
            _application = application;
            Name = name;
            Type = treeElementType.GetValueOrDefault(GuessElementTypeByFileExtension(name));
            _children = new ObservableCollection<TreeElementViewModel>();
            Children = new ReadOnlyObservableCollection<TreeElementViewModel>(_children);

            _commands = new ObservableCollection<CommandViewModel>();
            Commands = new ReadOnlyObservableCollection<CommandViewModel>(_commands);

            if (treeElementType.GetValueOrDefault(TreeElementType.Folder) != TreeElementType.Folder)
            {
                DefaultActionCommand = new CommandViewModel(OnDefaultActionCommand, "Open");

                _commands.Add(DefaultActionCommand);
            }
        }
Пример #3
0
        public TreeElementViewModel(ApplicationViewModel application, string name, TreeElementType?treeElementType = null)
        {
            _application = application;
            Name         = name;
            Type         = treeElementType.GetValueOrDefault(GuessElementTypeByFileExtension(name));
            _children    = new ObservableCollection <TreeElementViewModel>();
            Children     = new ReadOnlyObservableCollection <TreeElementViewModel>(_children);

            _commands = new ObservableCollection <CommandViewModel>();
            Commands  = new ReadOnlyObservableCollection <CommandViewModel>(_commands);

            if (treeElementType.GetValueOrDefault(TreeElementType.Folder) != TreeElementType.Folder)
            {
                DefaultActionCommand = new CommandViewModel(OnDefaultActionCommand, "Open");

                _commands.Add(DefaultActionCommand);
            }
        }
Пример #4
0
 public void AddCommand(CommandViewModel command)
 {
     _commands.Add(command);
 }
Пример #5
0
 public void AddCommand(CommandViewModel command)
 {
     _commands.Add(command);
 }