Friday, January 28, 2011

DependencyProperty in SilverLight/WPF

Unlike usual .Net property, DependencyProperty is defined as static member for a class. The dependencyProperty is not used to store the data as instance members, instead it is used to indicate that the class understands the defined depenency property, so knows how to use this DependencyProperty.

Usually, the class also defines the get/set wrap accessors for the DependencyProperty, they are instance members, since they use the DependencyProperty as key to read and set the data from the hashtable that stores all dependency values.

Note once a DependencyProperty is defined in a class, the value for this property can be set/get to any classes that derived from DependencyObject, not only the class defines it. For example Grid.ColumnProperty in Grid class can be set to a TextField instance. However, only Grid class knows how to apply this property when laying out the TextField. The TextField just stores the value into its DependencyProperty hash table, and never knows what this property really means. In this sense, the DependencyProperty is also called as AttachedProperty.

Jonathan

Sunday, January 2, 2011

adb.exe in Android SDK not installed on Windows Server 2008 (64 bit)

When installing Android SDK to Windows Server 2008 (64 bit), adb.exe does not get installed in platform-tools folder, it seems Windows server 2008 is not a supported platform, although it is unlikely there is any difference between Win Server 2008 (64 bit) and Windows 7 (64 bit) in term of eclipse for android support.

A workaround is copying the whole platform-tools folder from Windows 7 to Windows server 2008. And then set the Android sdk location again from Eclipse Windows->Preference menu, and all function works just fine.

Jonathan