コード例 #1
0
        /* クラスじゃなくてインターフェースでもらいたい。 */
        public ProductInfoViewModel(ProductInfo productInfo)
        {
            this.Id       = productInfo.Id;
            this.Name     = productInfo.Name;
            this.Category = productInfo.Category;
            this.Price    = productInfo.Price;

            this.EditCommand = new DelegateCommand(() =>
            {
                /*xamlには引数ありでdatacontextをかけないのでコードで書く*/
                var vm                = new EditInputViewModel(productInfo);
                var editInput         = new GRUD_makeS.Views.EditInput();
                editInput.DataContext = vm;
                editInput.ShowDialog();
            });
            this.DeleteCommand = new DelegateCommand(() =>
            {
                var deleteing = new Deleting();
                deleteing.Execute(Id);
            });
        }