I'm curious if there is any way in Pro 2.2 to create a Swatch for a given symbol, like you can do today with the WPF Runtime SDK. I didn't see anything obvious when inspecting the various CIM* symbol classes or in the Pro SDK API reference.
I am wanting to use the symbols the user has specified for certain layers in a WPF UI of my own creation for a consistent look and feel.
Solved! Go to Solution.
Hi Daniel,
This seems to be of 'common' interest, so I added sample code to cover some of the renders here:
https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/GetSymbolSwatch
While not ideal, there is at least one work around... ArcGIS.Desktop.Editing.Templates.EditingTemplate contains Task<ImageSource> GeneratePreviewAsync(int width, int height) which will generate a swatch. So the process would be three fold.
a) Generate a layer rendered with the symbol you want. (maybe you already have one though)
b) Generate a template that falls into that renderer class (again might already have one).
c) Get the preview off that template.
Of course a utility that generated a swatch from a symbol directly would be preferred.(edit. see Charlie's reply on SymbolStyleItem)
Daniel, you need a SymbolStyleItem. The property in question is "PreviewImage" (inherited from StyleItem).
So....given a symbol....how do you use a SymbolStyleItem to preview it?
...
return QueuedTask.Run(() => {
CIMSymbol symbol = ....;
var si = new SymbolStyleItem() {
Symbol = symbol,
PatchHeight = 64,
PatchWidth = 64
};
return si.PreviewImage;
});
This is a good topic for a snippet. I'll make sure one gets added.
Hi Daniel,
This seems to be of 'common' interest, so I added sample code to cover some of the renders here:
https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/GetSymbolSwatch
Thanks for all of the great support, that sample code is exactly what I was looking for!