In my project I used one button "Refresh" to refresh the DataGrid and registrtion from. This means when I insert a specific record that time it will insert into a database, and on the UI the Datagrid is not refreshing and the registration form is also maintaining filled information. Then if I click on the "refresh" button then the Datagrid and Registration form will also be refreshed. The problem is I am unable to write the refresh code in my Viewmodel. Therefore I wrote it in my Xaml.cs file. Here is my button click event:
Xaml.cs
public void Button_Click(object sender, RoutedEventArgs e)
{
viewmodelObj = new AndazPatrakViewModel();
viewmodelObj.BtnKharchKhVisibility = "Collapsed";
viewmodelObj.BtnUtpannakhVisibility = "Visible";
viewmodelObj.GetMaxId();
this.DataContext = viewmodelObj;
}
So in Viewmodel after Dbcontext.SaveChanges(); I want to call the Button_Click event shown above, but it asks for parameters for that function. How can i call this Button_Click event from my viewModel?