AnsweredAssumed Answered

Create a Double Fill Scale Bar

Question asked by TomFlahive on Apr 23, 2018
Latest reply on Apr 25, 2018 by TomFlahive

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 = QueuedTask.Run(() =>
   Coordinate2D coord2D = new Coordinate2D(xCoord, yCoord);
   CIMDoubleFillScaleBar myScaleBar = new CIMDoubleFillScaleBar
      Division = 4
   ScaleBarStyleItem scaleBarStyle = new ScaleBarStyleItem();
   scaleBarStyle.ScaleBar = myScaleBar;
   LayoutElementFactory.Instance.CreateScaleBar(activeLayout, coord2D, topMapFrame, scaleBarStyle);

Does anyone know what I might be missing?  I'm not sure if I am using the CIMDoubleFillScaleBar and the ScaleBarStyleItem correctly.  Thanks.