With a System.Windows.Controls.MenuItem I can set the icon as below:-
CloseMenuItem.Icon = CType(System.Windows.Markup.XamlReader.Parse("<Path xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Data='F1M16,1.166L14.834,0 8,6.834 1.166,0 0,1.166 6.834,8 0,14.834 1.166,16 8,9.166 14.834,16 16,14.834 9.166,8z' Stretch='Uniform' HorizontalAlignment='Center' Fill='#55475F77' IsEnabled = 'False'/>"), System.Windows.Shapes.Path)
How can I do the same with a System.Windows.Controls.Button which doesn't have an .Icon property but instead a .Content property which if i try and use above gives me "value of type 'path' cannot be converted to 'imagesource'." error message.
Currently I am just pointing to an PNG file, but would rather do it like above if possible
MyButton.Content = New System.Windows.Controls.Image With {
.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri(Path.Combine(My.Application.Info.DirectoryPath, "\Toolbar\MyIcon.png"), UriKind.RelativeOrAbsolute)),
.Width = 32,
.Height = 32,
.Margin = New System.Windows.Thickness(2, 0, 0, 0)
}
Also what is best way of converting an SVG to the XAML code needed to then use in above?
Thanks