I am trying to develop a ArcGIS Runtime WPF application. I have downloaded mil2525d.stylx file and I can apply these to symbols to FeatureCollectionLayer features using the below code. So, I could see the applied style for the FeatureCollectionLayer as a result on map using DictionarySymbolStyle and DictionaryRenderer.

List<Field> polyFields = new List<Field>();
Field symbolset = new Field(FieldType.Text, "symbolset", "symbolset", 10);
Field symbolentity = new Field(FieldType.Text, "symbolentity", "symbolentity", 10);
FeatureCollectionTable polysTable = new FeatureCollectionTable(polyFields, GeometryType.Polyline, SpatialReferences.Wgs84);
var path = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "mil2525d(1)_1.2.0.stylx");
DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.OpenAsync("mil2525d",path);
DictionaryRenderer renderer = new DictionaryRenderer(symbolStyle);
polysTable.Renderer = renderer;

This worked fine.

But, now I would like to show all the style symbols(icons) present in DictionarySymbolStyle in a WPF grid something like below by iterating through DictionarySymbolStyle object:

//<style Grid.Row="0" Grid.Column="0">
//<style Grid.Row="0" Grid.Column="1">
//<style Grid.Row="1" Grid.Column="0">
//<style Grid.Row="1" Grid.Column="1">

As I am new to ArcGISRuntime with WPF, I don't know how to proceed.


There is no way that to return a list of all symbols in dictionaryStyle because they are generated based on attributes passed. So if you know attributes for different symbols then you would need to loop it in some way and get symbol for them. Once you have the symbol you can calling CreateSwatchAsync() on symbol in the dictionary and bind it to image in a grid. Something like code below:

  <StackPanel VerticalAlignment="Top" HorizontalAlignment="Left" Orientation="Horizontal">                      
        <Image x:Name="icon"/>
   var symbol = await dictionary.GetSymbolAsync(attributes);
   icon.Source = await esri.ArcGISRuntime.UI.RuntimeImageExtensions.ToImageSourceAsync(await symbol.CreateSwatchAsync());
  • Thanks for replay. The above solution works only if I know the attribute(key of the symbol). But, my requirement is to display all dictionary symbols when application without using any filter criteria(i.e., attributes). How can I do that? – Parashuram May 16 at 5:59

ok so you can try following to get list of all symbols

var dictionary = await DictionarySymbolStyle.OpenAsync("mil2525d", localFilePath);
var sr = await dictionary.GetDefaultSearchParametersAsync();
var listofSymbols=await dictionary.SearchSymbolsAsync(sr);

Then for each symbol in the list set icon in the list or grid or whatever control you want to bind to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.