Table of Contents

Property VisualTheme

Namespace
Alternet.Editor.Wpf
Assembly
Alternet.Editor.Wpf.v9.dll

VisualTheme

Gets or sets visual theme for the editor.

public IVisualTheme VisualTheme { get; set; }

Property Value

IVisualTheme

Examples

Here is how to set a VisualTheme different VisualTheme from the C# code:

public partial class MainWindow : Window
{
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var textEditor = new Alternet.Editor.Wpf.TextEditor();
        textEditor.VisualThemeType = Alternet.Editor.Wpf.VisualThemeType.Custom;
        textEditor.VisualTheme = CustomVisualTheme.Instance;
    }
}

public class CustomVisualTheme
    : Alternet.Editor.Wpf.StandardVisualTheme
{
    public static readonly CustomVisualTheme Instance = new CustomVisualTheme();

    public CustomVisualTheme()
        : base("Custom")
    {
    }

    protected override VisualThemeColors GetColors()
    {
        var colors = DarkVisualTheme.Instance.Colors.Clone();
        colors.Reswords = System.Drawing.Color.Red;
        colors.WindowBackground = System.Drawing.Color.FromArgb(40, 40, 40);
        return colors;
    }
}

Here is how to set a VisualTheme different VisualTheme from the Visual Basic code:

Partial Public Class MainWindow
    Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim textEditor = New Alternet.Editor.Wpf.TextEditor()
        textEditor.VisualThemeType = Alternet.Editor.VisualThemeType.Custom
        textEditor.VisualTheme = CustomVisualTheme.Instance
    End Sub
End Class

Public Class CustomVisualTheme
    Inherits Alternet.Editor.Wpf.StandardVisualTheme

    Public Shared ReadOnly Instance As CustomVisualTheme = New CustomVisualTheme()

    Public Sub New()
        MyBase.New("Custom")
    End Sub

    Protected Overrides Function GetColors() As VisualThemeColors
        Dim Colors As VisualThemeColors = DarkVisualTheme.Instance.Colors.Clone()
        Colors.Reswords = System.Drawing.Color.Red
        Colors.WindowBackground = System.Drawing.Color.FromArgb(40, 40, 40)
        Return Colors
    End Function
End Class

Remarks

Use this property to set the color theme that specifies fonts and colors for all TextEditor visual elements and dialog boxes.

Two color themes are supported out of the box: Light and Dark. Set this value to a custom theme to provide customized fonts and colors.