[Unity] StaticExtensions
Posted: 20 Nov 2014, 21:02
Hi,
I'm trying to bring in some theming capabilities into our application, and we are thinking of using something along the lines of {x:Static Theming.PrimaryColor} to use the theming colors in our application. However, we're not sure how to get the statics defined. We've tried doing something like
as well as
But neither case worked when we tried to use it in our xaml. We keep getting a "Static value 's:BrandingStatic.TestColor' not found" error. According to the docs, the C++ library has a "IUISystem::SetStatic()" method to set the static, but I cannot find it in the Unity SDK. Is this something that isn't implemented in Unity yet, and is coming later? Or am I just doing it wrong?
Thanks
I'm trying to bring in some theming capabilities into our application, and we are thinking of using something along the lines of {x:Static Theming.PrimaryColor} to use the theming colors in our application. However, we're not sure how to get the statics defined. We've tried doing something like
Code: Select all
[Extended]
public static class BrandingStatics
{
static BrandingStatics()
{
Brushy = new SolidColorBrush(new Color(255, 0, 255, 255));
}
private static SolidColorBrush _brushy;
public static SolidColorBrush Brushy
{
get { return _brushy; }
set { _brushy = value; }
}
}
Code: Select all
[Extended]
public class BrandingStatic : SerializableComponent
{
//Note we need an instance so we can dynamically change the values dynamically
private static BrandingStatic _instance;
public static BrandingStatic Instance
{
get { return _instance ?? (_instance = new BrandingStatic()); }
}
public BrandingStatic()
{
Instance.SetTestColor(new SolidColorBrush(new Color(255, 0, 255, 255)));
}
private SolidColorBrush _testColor;
public void SetTestColor(SolidColorBrush brush)
{
_testColor = brush;
NotifyPropertyChanged("TestColor");
}
public static SolidColorBrush TestColor { get { return _instance._testColor; } }
}
Thanks