IMI docs

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mvvm [2019/01/11 13:15]
yura
mvvm [2019/01/13 12:01] (current)
yura
Line 8: Line 8:
 HorizontalContentAlignment="​Center" ​                         Вірівнення по ширині HorizontalContentAlignment="​Center" ​                         Вірівнення по ширині
 VerticalContentAlignment="​Center" ​                           Вірівнення по висоті VerticalContentAlignment="​Center" ​                           Вірівнення по висоті
-Content="​{Binding Time}" ​                                    ​Бінд який падає в клас StopwatchViewModel ​ з інтерфейсом  ​INotifyPropertyChanged +Margin="​0,​ 0, 0, -200" ​                                      ​Зсунути в низ на 200 px 
-Content="​{Binding Time, TargetNullValue='​00.00 UAH'​}" ​       TargetNullValue виводить введений текст зразу на екра ​+Content="​{Binding Time}" ​                                    ​Бінд який падає в клас StopwatchViewModel ​INotifyPropertyChanged 
 +Content="​{Binding Time, TargetNullValue='​00.00 UAH'​}" ​       TargetNullValue виводить введений текст зразу на екран (в деф позицію) 
 Command="​{Binding StartStopwatch}" ​                          ​Біндить якусь дію (в нашому випадку це кнопка) Command="​{Binding StartStopwatch}" ​                          ​Біндить якусь дію (в нашому випадку це кнопка)
 </​Code>  ​ </​Code>  ​
Line 44: Line 46:
  
 ---- ----
-**Реалізація кламу ButtonCommand через інтерфейс ICommand**+**Бінд кнопки виглядає наступним чином** 
 +<​Code:​csharp>​ 
 +<Button Content="​Click"​ Command="​{Binding StartStopwatch}"​ Width="​100"​ Height="​25"​ HorizontalContentAlignment="​Center"​ Margin="​0,​ 0, 0, -200"></​Button>​ 
 +</​Code>​ 
 + 
 + 
 +**Реалізація класу ButtonCommand через інтерфейс ICommand**
 <​Code:​csharp>​ <​Code:​csharp>​
 namespace CounterSalary.ViewModel namespace CounterSalary.ViewModel
Line 67: Line 75:
             action();             action();
         }         }
 +    }
 +}
 +
 +</​Code>​
 +**Робиться для того щоб потім можна було його реалізувати через моделі** 👇👇👇
 +<​Code:​csharp>​
 +        public ButtonCommand StartStopwatch { get; set; } = new ButtonCommand(() =>
 +        {
 +            _timer.startStopwatch();​
 +        });
 </​Code>​ </​Code>​
 ---- ----