Q:

Binding Background from other class

I've got following folder structure in my problem:
- Themes                   // folder
  - ThemeManager.cs        // self explaining
  - ITheme.cs              // theme interface
  - Light.cs               // typeof ITheme

ThemeManager.cs:
public static class ThemeManager
{
    public static ITheme Theme { get; set; } = new Light();
}

ITheme.cs:
//using System.Windows.Media
public interface ITheme
{
    string Color { get; set; }
    Brush Color2 { get; set; }
}

Light.cs:
//using System.Windows.Media
class Light : ITheme
{
    public string Color { get; set; } = "#FF00FF00";
    public Brush Color2 { get; set; } = new SolidColorBrush(Colors.Lime);
}

All three files are in the namespace MyProject.Themes.
I use the following code for binding the Background property in my XAML
xmlns:theme="clr-namespace:MyProject.Themes.ThemeManager.Theme"

but both
Background="{Binding theme:Color}"
Background="{Binding theme:Color2}"

make the Background transparent due to no result from the binding.
What am I doing wrong? How can I correctly bind the background?

A:

xmlns means XML-namespace. It is for namespace. So it supposed to be xmlns:theme="clr-namespace:MyProject.Themes". Also, it is a static property, you cannot bind it the same way as non-static.
In your case, it is
Background="{Binding Color, Source={x:Static theme:ThemeManager.Theme}}"

