Я новичок в WPF с MVVMLight и пытаюсь понять, как все работает. У меня есть кнопка в xaml:
<Button x:Name="button" Content="Button"
HorizontalAlignment="Left"
Margin="29,374,0,0"
VerticalAlignment="Top" Width="75"
Command="{Binding BeginCollectionCommand}"/>
, и View Model реагирует на нажатие кнопки. BeginCollectionCommand = new RelayCommand(BeginCollectionCommandExecute, () => true);
Мне не удалось найти ответ на мой вопрос по
- Как настроить кнопку для отключения
- Как установить для "content =" значение "working ..."
- Как повторно включить кнопку после завершения проекта
- Как установить для "content =" значение "Done"
- Я также хочу подождать 5 секунд, чтобы снова установить содержимое на «Пуск». Я полагаю, что могу сделать это с помощью thread.sleep (5000), но с остальными частями, которые мне не ясны.
В коде View Model есть привязка кнопки «BeginCollectionCommand», определенная как
public RelayCommand BeginCollectionCommand { get; set; }
public MainWindowViewModel()
{
BeginCollectionCommand = new RelayCommand(BeginCollectionCommandExecute, () => true);
//at this point i believe is where i set the button content to "working..."
//and disable.
}
public void BeginCollectionCommandExecute()
{
/// do my working class code
//I think at this point I want to set the code to change button content to
//enable, conent to "done" then wait and set to "start"
}
Может кто-нибудь помочь?