When a button with a FontIcon is disabled, it will be greyed out automatically. However, with a custom icon on a button, this does of course not happen. What is the best approach for mimicking this behvaiour? I understand you need two icons.
<AppBarButton.Icon>
<ImageIcon Source="{StaticResource CustomIcon}"/>
</AppBarButton.Icon>
So I think the best approach to do this is to create an eventhandler for IsEanbled on the button and change the icon there.
private void AppBarButton_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var button = sender as AppBarButton;
var icon = new ImageIcon();
if (button != null)
{
icon.Source = button.IsEnabled
? (SvgImageSource)App.Current.Resources["EnabledIcon"]
: (SvgImageSource)App.Current.Resources["DisabledIcon"];
button.Icon = icon;
}
}