private void OnForegroundChanged(DependencyObject sender, DependencyProperty dp) { if (_source != null && Foreground is SolidColorBrush foreground) { _source.SetColorProperty("Color_000000", foreground.Color); } }
private void ThemeChanged() { if (_visualSource != null) { var foreground = ActualTheme == ElementTheme.Light ? Colors.Black : Colors.White; var background = ActualTheme == ElementTheme.Light ? Colors.White : Colors.Black; var stroke = ActualTheme == ElementTheme.Light ? Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6) : Color.FromArgb(0xFF, 0x1F, 0x1F, 0x1F); var accent = (Color)Theme.Current["Accent"]; _visualSource.SetColorProperty("Foreground", foreground); _visualSource.SetColorProperty("Background", background); //_visualSource.SetColorProperty("Stroke", ActualTheme == ElementTheme.Light ? Color.FromArgb(0xFF, 0xF2, 0xF2, 0xF2) : Color.FromArgb(0xFF, 0x2B, 0x2B, 0x2B)); _visualSource.SetColorProperty("Stroke", _state == State.Normal ? foreground : stroke); _visualSource.SetColorProperty("Accent", _state == State.Normal ? foreground : accent); } }
public void SetColorProperty(string propertyName, Color value) { visual.SetColorProperty(propertyName, value); }