DependencyProperty with string value
Posted: 05 Sep 2013, 05:33
What is the proper way to implement a DependencyProperty that represents a string value? I have a simple UserControl object that is basically just some text blocks whose text I want to expose with Dependency Properties so I may set it programmatically. I have these properties as NsStrings right now but I get compilation errors when using NsProp.
Should the values be cast to NsStrings, or should it be another type? Do the function pointers provided to NsProp need to be of a certain signature? Right now for my setter I am passing in a NsString which I don't really want to do (I'd rather pass in a const NsString& or an NsString*).
I'm curious what the best way to do this is - the examples only seem to cover numeric types.
Should the values be cast to NsStrings, or should it be another type? Do the function pointers provided to NsProp need to be of a certain signature? Right now for my setter I am passing in a NsString which I don't really want to do (I'd rather pass in a const NsString& or an NsString*).
I'm curious what the best way to do this is - the examples only seem to cover numeric types.