Templarian / WindowsIcons

Windows Phone and Windows RT CC Icons
http://modernuiicons.com/
965 stars 179 forks source link

How to use XAML icons in Windows Store/Universal App. #209

Closed grokys closed 9 years ago

grokys commented 9 years ago

I have been using Templarian icons courtesy of MahApps.Metro for a while, and in WPF the icons are imported using a resource dictionary. Each time you can to use an icon you can either use:

<Rectangle>
    <Rectangle.Fill>
        <VisualBrush Visual="{StaticResource appbar_add}" />
    </Rectangle.Fill>
</Rectangle>

or

<Rectangle Fill="Black">
    <Rectangle.OpacityMask>
        <VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
    </Rectangle.OpacityMask>
</Rectangle>

However, neither VisualBrush nor OpacityMask are available to Windows Store/Universal Apps. What is the recommended way to consume the XAML?

Templarian commented 9 years ago

Can you please post this over on their issue tracker. They are happy to answer questions and have a very large community watching for new threads.

Glad you like the icons. The new version is being built out right now. :smile:

grokys commented 9 years ago

Sorry, but this wasn't a question about MahApps - MahApps isn't available for Windows Store Apps.

I want to know how to use the icons without MahApps!

Templarian commented 9 years ago

Oh, sorry. Still waking up. Skimmed it too quick. Below is how most use them. In this example 48 is the scaled size in the Viewbox.

<Viewbox Width="48" Height="48">
    <Canvas Width="76" Height="76">
        <Path Data="... PATH DATA HERE ..." Fill="Black" />
    </Canvas>
</Viewbox>
grokys commented 9 years ago

Ok, so the Path has to be included in the view for every usage - there's no way that you know of to define the icons once and then reuse them throughout?

Templarian commented 9 years ago

That is the way I've done it. I tweeted this out to see if anyone can help provide some more knowledge.

grokys commented 9 years ago

This seems to address the issue:

http://www.jerriepelser.com/blog/3-ways-to-add-modern-icon-goodness-windows-8-1

However, it's not completely straightforward!

I wonder if this could be automated to produce a set of PathIcon resources for WinRT?

Could you re-open this issue, as I don't think it's resolved.