What i am trying to do ,is after i used the sketch editor to create some graphic on the screen, i want to add label for it and let the user update it properties(text, font color, font size, etc)
this is the code i have atm
public void AddOrUpdateLabel(Guid guid, string text)
{
var graphic = GetGrahpic(guid)
graphic.attributes[MapConstans.LabelKey] = text;
graphic.attributes["GUID"] = guid;
var labelClass = CreateAndGetExtendedLabel(guid)
int nextInt = rand.next(10,100);//just for testing purpose
labelClass.Symbol.Font.size = nextInt;
AddLabelToMap(labelClass)
}
public LabelClass CreateAndGetExtendedLabel(Guid guid)
{
return new Label()
{
LabelPlacement = LabelPlacement.Default,
LabelExpression = $"[{MapConstans.LabelKey}]";
Priority = 8,
DeconfictionStrategy = DeconfictionStrategy .Static,
RemoveDuplicates = RemoveDuplicatesStrategy.None,
Symbol = new LabelSymbol()
{
Color = Color.White,
HaloColor = Color.Black,
HaloSize = 1,
Font = new Font() {Family = "Arial", Size= 12, weight =
Fontweight.Bold},
},
Where = $"GUID LIKE {guid}";
}
public void AddLabelToMap(LabelClass labelClass)
//adds to labelDefention
with the above code no label is shown but if i remove the Where = $"GUID LIKE {guid}"; the label is shown but for all graphics at the same layer
P.s
Lets say that, for now, i only create new graphics and not update them, need to add some mechanism if the LabelClass already exists