你的问题类似于在C++ WinRT中创建依赖属性的写法,参考http://msdn.microsoft.com/zh-cn/library/windows/apps/hh920267.aspx
你需要在cpp中为你的私有成员初始化:
header:
public ref class CustomControl sealed : public Windows::UI::Xaml::Controls::ContentControl
{
private:
static SolidColorBrush^ _X;
public:
CustomControl();
static property SolidColorBrush^ X
{
SolidColorBrush^ get() { return _X; }
void set(SolidColorBrush^ value) { _X = value; }
}
};
cpp
SolidColorBrush^ CustomControl::_X = ref new SolidColorBrush(Windows::UI::Colors::Red);
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
