[CONNECT #C] How to apply textstyle to textelement

I have the code below working except the textstyle is not applied. The textstyle exists in the active file. Probably something simple that I'm missing.

I've seen the TextStyle.AddToElement(element, key) but have no idea what the "key" parameter is.

private static void PlaceTextElement(string inputString, DPoint3d origin, DgnTextStyle textStyle, string levelName)
{
 DgnModel currentModel = Session.Instance.GetActiveDgnModel();
 TextBlock textBlock = new TextBlock(textStyle, currentModel);
 textBlock.SetUserOrigin(origin);
 textBlock.AppendText(inputString);
 TextElement textElement = (TextElement)TextElement.CreateElement(null, textBlock);
 LevelId levelId = GetLevelIdByLevelName(levelName);
 ElementPropertiesSetter propSetter = new ElementPropertiesSetter();
 propSetter.SetLevel(levelId);
 propSetter.SetColor(SymbologyValue.ColorByLevel);
 propSetter.SetWeight(SymbologyValue.WeightByLevel);
 propSetter.Apply(textElement);
 textElement.AddToModel();
}

Parents Reply Children
No Data