Method ImageUtil.LoadWpfImageElement
Overload
Loads WPF image element from file, resource or string. Supports xaml, png and other image formats supported by WPF.
public static FrameworkElement LoadWpfImageElement(string image)
Parameters
image (string)
Can be:
|
Returns
FrameworkElement
If image is XAML icon name or starts with |
Exceptions
Remarks
image can be an XAML icon name from the Icons tool of LibreAutomate (LA), like "*Pack.Icon color"
. If 2 colors like "*Pack.Icon #008000|#00FF00"
, the second color is for high contrast dark theme. If like "*Pack.Icon"
(without color), will use the system color of control text. To make the displayed icon smaller or in some cases less blurry, can be specified a logical size <= 16, like "*Pack.Icon color @12"
or "*Pack.Icon @12"
; it is the logical width and height of the icon rendered at the center of a box of logical size 16x16. The LA compiler finds such strings anywhere in code, gets their XAML from the database, and adds the XAML to the assembly as a string resource (see Properties > Resource > Options). This function gets the XAML from resources (ResourceUtil.GetString). If fails, then tries to get XAML from database, and fails if LA isn't running. Uses ScriptEditor.GetIcon.