public SimpleCommandWithCancellationUserControl() { InitializeComponent(); #region SetUp MVVMContext mvvmContext = new MVVMContext(); mvvmContext.ContainerControl = this; ProgressBarControl progressBar = new ProgressBarControl(); progressBar.Dock = DockStyle.Top; SimpleButton commandButton = new SimpleButton(); commandButton.Text = "Start Command Execution"; commandButton.Dock = DockStyle.Top; SimpleButton cancelButton = new SimpleButton(); cancelButton.Text = "Cancel Command Execution"; cancelButton.Dock = DockStyle.Top; cancelButton.Parent = this; commandButton.Parent = this; progressBar.Parent = this; #endregion SetUp #region #simpleCommandWithCancellation mvvmContext.ViewModelType = typeof(ViewModelWithAsyncCommandAndCancellation); // UI binding for button mvvmContext.BindCommand <ViewModelWithAsyncCommandAndCancellation>(commandButton, x => x.DoSomethingAsynchronously()); // UI binding for cancelation mvvmContext.BindCancelCommand <ViewModelWithAsyncCommandAndCancellation>(cancelButton, x => x.DoSomethingAsynchronously()); // UI binding for progress mvvmContext.SetBinding(progressBar, p => p.EditValue, "Progress"); #endregion #simpleCommandWithCancellation }