Should I wrap the Viewbox in a ControlTemplate and use it inĬontentPresenter Template property? This way I don't need to use the I wrote it without VS, from memory, so there could be some mistakes. So you should use simpliest container to achive good performance. Viewbox isnt so good, because it applies transformations to content. (it should parse and provide value)ģ) Create a custom control IconControl for displaying icons with dependency property IconPath (String) and bind it in your template by template binding Steps are next:ġ) You have your resources in your project with xaml or svgĢ) Create your markup extension which will provide a value of Geometry by a path of your embedded resource file with an icon. I think you can create it manually by reading all your files. Should I wrap the Viewbox in a ControlTemplate and use it in ContentPresenter Template property? This way I don't need to use the x:Shared attribute on Canvas. Maybe remove the Viewbox and always use the Canvas in a Viewbox in my own view? Is it more effective to use a Label (or some other control)? Should I use a ContentPresenter and set its Content property and set the Canvas x:Shared="false"? What is most resource effective way of showing this element? Let's assume I have wrapped it in a ResourceDictionary and given the Viewbox a x:Key="SquareIcon" value. Is there a way to have only one ResourceDictionary where I can import all of these XAML files? The image will be shown multiple times, for example in a ListViewItem or any other element that has an ItemsSource. This is annoying because I cannot edit the file in Inkscape anymore without having to remove the ResourceDictionary before. To use this file I'd normally have to wrap it in a ResourceDictionary. When you create an image with Inkscape and save as XAML you'll only have a Viewbox inside an XAML. There are many articles on the internet but not many of them show the pro and cons of each solution. This question aims to be a best practice on how to use images created with Inkscape and saved as XAML.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |