I am trying to create a Double Fill Scale Bar in the ArcGIS Pro SDK.. I was able to create a default scale bar using the Esri snippets example (Pro Snippets for Layouts) which did not require specifying the type or styling for the scale bar. But now I am looking to create a scale bar with a double fill format which means I do need to somehow specify the type and style of the scale bar. I feel like I am getting close with the following code (just the relevant part of the code below), but it crashes ArcGIS Pro:
Task t <SPAN class="operator token">=</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">{</SPAN>
Coordinate2D coord2D <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Coordinate2D</SPAN><SPAN class="punctuation token">(</SPAN>xCoord<SPAN class="punctuation token">,</SPAN> yCoord<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
CIMDoubleFillScaleBar myScaleBar <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">CIMDoubleFillScaleBar</SPAN>
<SPAN class="punctuation token">{</SPAN>
Division <SPAN class="operator token">=</SPAN> <SPAN class="number token">4</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
ScaleBarStyleItem scaleBarStyle <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ScaleBarStyleItem</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
scaleBarStyle<SPAN class="punctuation token">.</SPAN>ScaleBar <SPAN class="operator token">=</SPAN> myScaleBar<SPAN class="punctuation token">;</SPAN>
LayoutElementFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateScaleBar</SPAN><SPAN class="punctuation token">(</SPAN>activeLayout<SPAN class="punctuation token">,</SPAN> coord2D<SPAN class="punctuation token">,</SPAN> topMapFrame<SPAN class="punctuation token">,</SPAN> scaleBarStyle<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Does anyone know what I might be missing? I'm not sure if I am using the CIMDoubleFillScaleBar and the ScaleBarStyleItem correctly. Thanks.