Can you please make a small application, illustrating the problem you are speaking about, and upload it somewhere?
(You can mail it to me - my email is firstname.lastname@example.org)
This is because the code fragment you've wrote is ok, and problem isn't in it.
From where you a calling code you've given?
Can you post more details about exception? Where does it happen? What reference is null?
Setting value to usual CLR property or using associated with it DependencyProperty in SetValue method are equal, CLR property is made only for developer's convenience.