using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using Telerik.Windows.Controls;

namespace WpfApp99
{
    public class DataModel
    {
        public string Title { get; set; }
    }

    public class MainWindowViewModel :ViewModelBase
    {
        private ObservableCollection<DataModel> comboData;
        public ObservableCollection<DataModel> ComboData
        {
            get => comboData;
            set
            {
                comboData = value;
                OnPropertyChanged("ComboData");
            }
        }

        private DataModel comboDataItem;
        public DataModel ComboDataItem
        {
            get => comboDataItem;
            set
            {
                comboDataItem = value;
                OnPropertyChanged("ComboDataItem");
            }
        }

        private string buttonText;
        public string ButtonText
        {
            get => buttonText;
            set
            {
                buttonText = value;
                OnPropertyChanged("ButtonText");
            }
        }

        public ICommand OnClickButtonCommand
        { 
            get => new DelegateCommand(x => 
            {
                var name = x as string;
                switch(name)
                {
                    case "A":
                        ButtonText = "A A A A A";
                        break;
                    case "B":
                        ButtonText = "B B B B B";
                        break;
                    case "C":
                        ButtonText = "C C C C C";
                        break;
                    case "Main":
                        ButtonText = "M A I N !";
                        break;
                    default :
                        ButtonText = "- - - - -";
                        break;
                }
            });
        }

        public MainWindowViewModel()
        {
            ComboData = new ObservableCollection<DataModel>( new List<DataModel>
            {
                new DataModel { Title = "A" },
                new DataModel { Title = "B" },
                new DataModel { Title = "C" },
                new DataModel { Title = "D" },
                new DataModel { Title = "E" },
            });
            ComboDataItem = ComboData.FirstOrDefault();
        }

    }
}
