diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs index d742974ab73..2060cd25bb4 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs @@ -21,6 +21,8 @@ public sealed partial class XamlCodeEditor : UserControl public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(XamlCodeEditor), new PropertyMetadata(string.Empty)); + private ThemeListener _themeListener = new ThemeListener(); + public XamlCodeEditor() { this.InitializeComponent(); @@ -40,7 +42,7 @@ public async void ReportError(XamlExceptionRange error) // Highlight Error Line XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration( range, - new IModelDecorationOptions() { IsWholeLine = true, ClassName = _errorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() })); + new IModelDecorationOptions() { IsWholeLine = true, ClassName = ErrorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() })); // Show Glyph Icon XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration( @@ -121,10 +123,12 @@ public string Text public DateTime TimeSampleEditedLast { get; private set; } = DateTime.MinValue; - private CssLineStyle _errorStyle = new CssLineStyle() + private CssLineStyle ErrorStyle { - BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) - }; + get => _themeListener.CurrentTheme.Equals(ApplicationTheme.Light) ? + new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) } : + new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0x66, 0x00, 0x00)) }; + } private CssGlyphStyle _errorIconStyle = new CssGlyphStyle() {