Select to view content in your preferred language

Search symbols does not return any style items

649
3
Jump to solution
03-03-2022 01:08 AM
KarthikAditya
New Contributor III

I'm trying to find a Line Symbol in the project style items but the function returns an empty collection. This is my reference

//Get all styles in the project
var styleProjectItem2D = Project.Current.GetItems<StyleProjectItem>().FirstOrDefault(s => s.Name == "ArcGIS 2D");

//Get a specific style in the project by name
var arrowLineSymbol = styleProjectItem2D.SearchSymbols(StyleItemType.LineSymbol, "Arrow Line 2 (Mid)")[0];

The 'Arrow Line 2 (Mid)' symbol cannot be found even though it is available in the ArcGIS Pro project style

KarthikAditya_0-1646298381689.png

 

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

You can repair project manually. Project file is renamed zip file. You can extract it and modify damaged part.

More info in my own question here:

https://community.esri.com/t5/arcgis-pro-sdk-questions/styleprojectitem-method-searchcolorramps-alwa... 

View solution in original post

3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

I have similar situation with color ramps month ago. It was problem with ArcGIS Pro project. Have you tried your code on new created ArcGIS Pro project?

KarthikAditya
New Contributor III

Thanks for the suggestion, running the code on another project found the symbols.

How to solve this problem in those projects where symbols are not found?

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi,

You can repair project manually. Project file is renamed zip file. You can extract it and modify damaged part.

More info in my own question here:

https://community.esri.com/t5/arcgis-pro-sdk-questions/styleprojectitem-method-searchcolorramps-alwa...