public void ApplyStyle(string subString, Style style) { DynamicTextSource dts = (TextSource as DynamicTextSource); if (dts != null) { dts.StyledText.ApplyStyle(subString, style); dts.Load(dts.StyledText); } }
/// <summary> /// Load text into control FCTB /// </summary> /// <param name="text">any text</param> private void LoadText(string text) { // create styled text and apply coloring var styledText = new StyledText(text); // create our custom TextSource var ts = new DynamicTextSource(this); // load string into component ts.Load(styledText); // assign TextSource to the component TextSource = ts; }