private void pbAdd_Click(object sender, EventArgs e) { var postFilterGpVM = new PostFilterGroupItemViewModel(ViewModel.EventControl); var filterGroupItem = new PostFilterGroupItem(postFilterPanel.Controls.Count+1) { ViewModel = postFilterGpVM }; ViewModel.AddFilterGroups(postFilterGpVM); postFilterPanel.Controls.Add(filterGroupItem); subscribeToControlEvents(filterGroupItem); }
private void subscribeToControlEvents(PostFilterGroupItem filterGroupItem) { filterGroupItem.DeleteClicked += deleteClicked; }