How to set Resize Behavior of a scale bar through SDK. I can see this property can be set from UI and not sure how to do that through code.
I have set the Division property and tried, if setting this value would set the resize behavior to "adjust width" by default. It doesn't. How to set Resize behavior ?
Solved! Go to Solution.
Hi
You can set the Resize behavior using the CIM Definition of the scale bar. In my example, I used a simple "Scale Line" type of scale bar. The CIM Definition you retrieve needs to be cast to the type of scale bar you are using.
QueuedTask.Run( () => {
var lyt = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault().GetLayout();
Element scaleBar = lyt.FindElement("Scale Bar") as Element;
var scaleBarDefn = scaleBar.GetDefinition() as CIMScaleLine;
//Enums
scaleBarDefn.FittingStrategy = ScaleBarFittingStrategy.AdjustDivisionAndDivisions;
scaleBar.SetDefinition(scaleBarDefn);
});
Thanks!
Uma
Hi
You can set the Resize behavior using the CIM Definition of the scale bar. In my example, I used a simple "Scale Line" type of scale bar. The CIM Definition you retrieve needs to be cast to the type of scale bar you are using.
QueuedTask.Run( () => {
var lyt = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault().GetLayout();
Element scaleBar = lyt.FindElement("Scale Bar") as Element;
var scaleBarDefn = scaleBar.GetDefinition() as CIMScaleLine;
//Enums
scaleBarDefn.FittingStrategy = ScaleBarFittingStrategy.AdjustDivisionAndDivisions;
scaleBar.SetDefinition(scaleBarDefn);
});
Thanks!
Uma
Thanks Uma Harano. I am using a Double Fill Scale bar, only change I made is that and it worked.