1

I have a XAML file with the following Content, appbar.add.xaml:

<?xml version="1.0" encoding="utf-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="appbar_add" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
    <Path Width="38" Height="38" Canvas.Left="19" Canvas.Top="19" Stretch="Fill" Fill="#FF000000" Data="F1 M 35,19L 41,19L 41,35L 57,35L 57,41L 41,41L 41,57L 35,57L 35,41L 19,41L 19,35L 35,35L 35,19 Z "/>
</Canvas>

My question is, how can I use this "image" as an icon in my project?

This is the way I do it with a png file:

<RibbonButton x:Name="ButtonListNew" Label="Neu" KeyTip="I" LargeImageSource="Images\Resources\appbar.add.xaml" Command="l:MainWindow.RoutedCommandListNew" />
MeerArtefakt
  • 386
  • 2
  • 6
  • 26
  • I want to know the answer to this question too. I just started working with WPF application on XAML in Visual Studio using some DevExpress and want to use icons downloaded from websites like [materialdesignicons.com](https://materialdesignicons.com/) without working with each one like wrapping into ResourceDictionary and specifying they into global MergedDictionaries. – Даниил Пронин Oct 16 '15 at 02:27
  • 1
    Also there is a similar question with answers: http://stackoverflow.com/questions/13292179/best-way-to-use-a-vector-image-in-wpf – Даниил Пронин Oct 16 '15 at 02:35
  • 1
    There is another post related to this [link](https://stackoverflow.com/questions/51899503/wpf-use-canvas-as-imagesource/51904355#51904355) – Suresh Aug 26 '18 at 04:35

1 Answers1

1

i don't know what a RibbonButton is but I know you can do this with a button.

<Button>
    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="appbar_add" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
        <Path Width="38" Height="38" Canvas.Left="19" Canvas.Top="19" Stretch="Fill" Fill="#FF000000" Data="F1 M 35,19L 41,19L 41,35L 57,35L 57,41L 41,41L 41,57L 35,57L 35,41L 19,41L 19,35L 35,35L 35,19 Z "/>
    </Canvas>
</Button>
bad_coder
  • 11,289
  • 20
  • 44
  • 72
Teyar Raid
  • 26
  • 5