I have a button on an AppBar which I have set to become enabled when a property in the ViewModel becomes true. For some reason the IsEnabled binding is only being checked the first time the AppBar is shown. Have I missed something?
Here is my button XAML in the View (AppBar xaml omitted for clarity):
<Button Style="{StaticResource DocumentAppBarButtonStyle}" AutomationProperties.Name="Approve"
Command="{Binding ApproveTimesheetCommand, Mode=OneWay}"
IsEnabled="{Binding IsAbleToProcessTimesheet, Mode=OneWay}" />
And here is my property in the ViewModel:
public bool IsAbleToProcessTimesheet
{
get
{
return SelectedTimesheets.Count() > 0;
}
}
Setting a breakpoint on the property shows that it is only called the first time the App Bar is shown. Subsequent calls to show the App Bar don't fire checks to the IsEnabled property.
Do you need to set something to get the XAML to call the property each time the AppBar is shown?
Any help would be appreciated.