Backgorud:
We can usually use content of Icon Resource by AXAML in Avalonia framework such as this example
,the mail_copy_regular is an object which is a StreamGeometry type and the icon resources provided by avalonia whose url is https://avaloniaui.github.io/icons.html.
Problem:
Now I want to try to use content of Icon Resource in code-behind mode situation but I don’t know how to do it.The reason for doing this is that I create the MenuItem object in code-behind mode and assign his property of Icon. The Icon is also an object and can be instantiated by the derived class PathIcon.By reading the official api documentation I found that PathIcon have a Data property which is a StreamGeometry type.So I want to use the official icon resources provided by avalonia to instantiate StreamGeometry.
I try to create the Data object in code-behind mode by setting StreamGeometry property of Data.
helloworld is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.