views:

19

answers:

0

I have mainpage.xaml, which has save button. Then I have couple of views, that I change on the fly, like dataentry.xaml, customerdetail.xaml etc. in the middle of the mainpage xaml. The button is common to all the grids. So on the visible grid, when there is a data entry change happen, I want to enable to save button and when selected it should call appropriate view save method.

In mainpage.xaml when the selection change happen, say, user selected to see dataentry.xaml, I will do the following code in my mainpage.xaml

Binding saveBinding = new Binding("Save");
saveBinding.Source = _dataentryView.ViewModel;
SaveButton.SetBinding(Button.CommandProperty, saveBainding);

when I coming to main page first time, the save button is disabled. I enter some values to the data grid expecting the save button to enabled and is not. With data entered, I swtich to another view and then come back to dataentry view, this time, save button gets enabled.

I was expecting the save button to be enabled, automatically with this binding but it is not. Any idea why would not this happen?