This project is read-only.

Using in TabControl loses styling

Topics: User Forum
Jun 5, 2012 at 4:45 AM

I am using ScintillaNET in a WPF app. I am putting the objects in a TabControl. When I first create and use some custom styling all works fine. However, when I change tabs (thereby hiding the Scintilla window) and then return to the tab (unhide) ALL styling is gone except background color.

I create it like this:

 

editor = new Scintilla();
editor.ConfigurationManager.CustomLocation = configFilePath;
editor.ConfigurationManager.Language = "js";
editor.BackColor = System.Drawing.Color.Black;
editor.Caret.Color = System.Drawing.Color.White;
editor.IsBraceMatching = true;
editor.Folding.IsEnabled = true;
editor.Margins[0].Width = 40;
editor.Margins[0].IsClickable = true;
editor.Margins[0].IsFoldMargin = true;

 

And the file at configPathFile has this:

<?xml version="1.0" encoding="utf-8" ?>
<ScintillaNET>
  <Language Name="js">
    <Indentation TabWidth="4" UseTabs="true"/>
    <Lexer>
      <Keywords List="0">print sleep</Keywords>
    </Lexer>
    <Styles>
      <Style Name="COMMENT" ForeColor="DarkGreen" BackColor="Black"/>
      <Style Name="COMMENTLINE" ForeColor="DarkGreen" BackColor="Black"/>
      <Style Name="COMMENTDOC" ForeColor="DarkGreen" BackColor="Black"/>
      <Style Name="NUMBER" ForeColor="Red" BackColor="Black"/>
      <Style Name="WORD" ForeColor="White" BackColor="Black"/>
      <Style Name="STRING" ForeColor="LightGreen" BackColor="Black"/>
      <Style Name="CHARACTER" ForeColor="LightGreen" BackColor="Black"/>
      <Style Name="OPERATOR" ForeColor="Cyan" BackColor="Black"/>
      <Style Name="IDENTIFIER" ForeColor="Yellow" BackColor="Black"/>
      <Style Name="GLOBALCLASS" ForeColor="Magenta" BackColor="Black"/>
      <style Name="STANDARD" BackColor="Red" ForeColor="Black" />
      <style Name="DEFAULT" BackColor="Red" ForeColor="Black" />
      <style Name="BRACELIGHT" BackColor="Yellow" ForeColor="Gray" />
      <style Name="BRACEBAD" BackColor="Red" ForeColor="Gray" />
    </Styles>
  </Language>
</ScintillaNET>
Maybe it has something to do with this: http://scintillanet.codeplex.com/workitem/11811?ProjectName=scintillanet

Jun 5, 2012 at 1:50 PM

Never mind. I was doing something stupid.