Category / Section
How to apply the Format color for the same start and end text of lexem with nested format in EditControl?
1 min read
EditControl consider the Format based on Start and End text of lexem. It separates the codes by space. Nested lexem format color can be applied using its SubLexem property. Here we have considered the [::] as parent lexem and [:] as sub-lexem. The following code demonstrates the same.
Code Example: [Xaml]
<syncfusion:FormatsCollection x:Key="formats"> <!—Set Format Color --> <syncfusion:EditFormats Foreground="Red" FormatName="FieldsFormat"/> <syncfusion:EditFormats Foreground="Yellow" FormatName="StringFormat"/> </syncfusion:FormatsCollection> <!--Field Syntax--> <syncfusion:Lexem IsMultiline="False" ContainsEndText="False" ParentLexemType="Literals" StartText="::" EndText="::" LexemType="Literals" FormatName="FieldsFormat" /> <syncfusion:Lexem IsMultiline="False" ContainsEndText="False" ParentLexemType="Literals" StartText=":" EndText=":" LexemType="Literals" FormatName="StringFormat" /> <!—For nested lexem--> <syncfusion:Lexem ContainsEndText="True" IsMultiline="True" StartText="::" IsRegex="true" EndText="::" LexemType="Literals" FormatName="FieldsFormat"> <syncfusion:Lexem.SubLexems> <syncfusion:LexemCollection> <syncfusion:Lexem ContainsEndText="False" IsMultiline="False" StartText=":" IsRegex="True" LexemType="Literals" FormatName="StringFormat" /> </syncfusion:LexemCollection> </syncfusion:Lexem.SubLexems> </syncfusion:Lexem>
Screenshot
Sample: EditControlSample