/***************************************************************************** * DependencyProperty.h * * * * System::Windows::DependencyProperty definition file * * Copyright (c) XFX Team. All rights reserved * *****************************************************************************/ #ifndef _SYSTEM_WINDOWS_DEPENDENCYPROPERTY_ #define _SYSTEM_WINDOWS_DEPENDENCYPROPERTY_ #include #include "PropertyMetaData.h" using namespace System::Collections::Generic; namespace System { namespace Windows { /** * */ template class DependencyProperty { private: static Dictionary > _registeredProperties; DependencyProperty(const String& propertyName, const int type, T defaultValue) : DefaultValue(defaultValue), Name(propertyName) { } public: const T DefaultValue; const String Name; static DependencyProperty Register(const String& propertyName, const int type); static DependencyProperty Register(const String& propertyName, const int type, PropertyMetaData const * propertyMetaData); }; /////////////////////////////////////////////////////////////////////// template DependencyProperty DependencyProperty::Register(const String& propertyName, const int type) { Derived_from(): return Register(propertyName, type, new PropertyMetaData(null)); } template DependencyProperty DependencyProperty::Register(const String& propertyName, const int type, PropertyMetaData const * propertyMetaData) { Derived_from(): _registeredProperties.Add(type, Dictionary()); _registeredProperties[type].Add(propertyName, propertyMetaData->DefaultValue); return DependencyProperty(propertyName, type, propertyMetaData->DefaultValue); } } } #endif //_SYSTEM_WINDOWS_DEPENDENCYPROPERTY_