All,
Has anyone successfully created a balloon callout on graphics layer by codes ? I asked this question before with previous version of arcgis Pro. I was under the impression with version 2.8 I should be able to do it but no luck so far. Below is my codes. I got all other properties correct but NO callout arrow. Thanks in advance for your help.
Not a callout
_subjectTextSymbol = await CreateBalloonCalloutAsync(ColorFactory.Instance.RedRGB);
.
.
.
subjectLabelGraphic.Text = "Subject";
subjectLabelGraphic.Symbol = _subjectTextSymbol.MakeSymbolReference();
//Add the graphic label
graphicsLayer.AddElement(subjectLabelGraphic);
.
.
.
private static Task<CIMTextSymbol> CreateBalloonCalloutAsync(CIMColor textColor)
{
return QueuedTask.Run<CIMTextSymbol>(() =>
{
//create a text symbol
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(textColor, 11, "Corbel", "Regular");
//A balloon callout
var balloonCallout = new CIMBalloonCallout();
//set the callout's style
balloonCallout.BalloonStyle = BalloonCalloutStyle.RoundedRectangle;
//Create a solid fill polygon symbol for the callout.
var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB, SimpleFillStyle.Solid);
//Set the callout's background to be the black polygon symbol
balloonCallout.BackgroundSymbol = polySymbol;
//margin inside the callout to place the text
balloonCallout.Margin = new CIMTextMargin
{
Left = 5,
Right = 5,
Bottom = 5,
Top = 5
};
//assign the callout to the text symbol's callout property
textSymbol.Callout = balloonCallout;
return textSymbol;
});
}