user4071320
user4071320

Reputation:

WPF MetroTheme = Icon Ressources

Icon on button with Icon ressources Metro

I want to add image in my button with the metro pack icon, but i cant add the resources in my App.xaml

I used this command : Install-Package MahApps.Metro.Resources and added <ResourceDictionary Source="/Resources/Icons.xaml" /> In my App.xaml but this line didnt work, I have an error...

So I cant add my image with <VisualBrush Visual="{StaticResource appbar_add}" />

Source: official documentation But I cant use the icon resource.

Upvotes: 2

Views: 2619

Answers (3)

MAXE
MAXE

Reputation: 5122

I'm using that package too in my WPF apps (MahApps.Metro), but I can only reference icons using DynamicResource (so, not using StaticResource), for example:

<VisualBrush Stretch="Fill" Visual="{DynamicResource appbar_magnify}" />

Look at the official documentation here

Upvotes: 0

Jason Fry
Jason Fry

Reputation: 1234

The MahApps.Metro.Resources package does not contain the styles for those circle buttons. Use command Install-Package MahApps.Metro.

App.xaml: App.xaml

MainWindow.xaml: Window.xaml

Result: Result

Upvotes: 2

Jason Fry
Jason Fry

Reputation: 1234

The Fill property on each path in Icons.xaml references a nonexistent BlackBrush:

BlackBrush issue

You can fix this by replacing "{DynamicResource BlackBrush}" with "Black" or including Colors.xaml in your App.xaml.

Fixed

Upvotes: 1

Related Questions