public MessagePropertiesForm(IDialogViewModel host) { this.viewModel = host; InitializeComponent(); this.contentModeButtons = new[] { contentModeButton1, contentModeButton2, contentModeButton3 }; InitializeTable(CreateRows()); var tableUpdater = Updaters.Create(() => viewModel.Data, UpdateView); host.ChangeNotification.CreateSubscription(tableUpdater); FormClosed += (s, e) => host.OnClosed(); for (var i = 0; i < contentModeButtons.Length; ++i) { var scopedIdx = i; contentModeButtons[i].Click += (s, e) => viewModel?.OnContentViewModeChange(scopedIdx); } }