I have this library with custom Color properties. I wanna be able to use these properties in XAML like this:
<Style TargetType="{x:Type eg:MyWindow}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="CustomClass.CustomColorProperty"/>
</Setter.Value>
</Setter>
</Style>
The namespace that contains CustomClass is already referenced. How should I go about this? Thanks.
EDIT:
I just noticed that CustomClass is static, so I can't create an instance of it in XAML. Also, when I type eg:, CustomClass doesn't show up in intellisense. I can't get any of your solutions to work, even though they should, if I had an instance class. Is there a workaround for this situation?
EDIT 2:
This is the actual class and namespace:
namespace Assergs.Windows
{
public static class OfficeColors
{
public class Background
{
public static Color OfficeColor1 = (Color)ColorConverter.ConvertFromString("#e4e6e8");
public static Color OfficeColor2 = (Color)ColorConverter.ConvertFromString("#dce0ed");
public static Color OfficeColor3 = (Color)ColorConverter.ConvertFromString("#a8c3e0");
}
}
}
And this is the XAML namespace:
xmlns:aw="clr-namespace:Assergs.Windows;assembly=Assergs.Windows"
And if I use this line, as suggested by Zenuka:
<SolidColorBrush Color="{x:Static aw:OfficeColors.Background.OfficeColor1}"/>
It throws this error at compile time:
Cannot find the type 'OfficeColors.Background'. Note that type names are case sensitive.