When a user presses a button, I'd like that button to disappear and be replaced by a Confirm button. The code below is what I thought would make the button disappear, but when I click the button, nothing happens. The DeleteButton() method is properly wired to the XAML using Caliburn Micro conventions. How can I control the button's visibility, or any other property, from the ViewModel? Thanks.
XAML:
<Button x:Name="DeleteButton" Visibility="{Binding DeleteButtonVisibility}"/>
ViewModel:
bool _deleteButtonVisibility = true;
public bool DeleteButtonVisibility
{
get { return _deleteButtonVisibility; }
set
{
_deleteButtonVisibility = value;
NotifyOfPropertyChange(() => DeleteButtonVisibility);
}
}
public void DeleteButton()
{
DeleteButtonVisibility = false;
}
Visibilityalways requires a converter from bool to Visibility enum, but for other properties, this is fine. - Alejandro