A
Anthony Paul
Hello everyone,
I just ran into the following scenario and couldn't figure out
something that I thought should be easy as pie.
I have a class that contains a dependency property, let's say it's a
DateTime property. I can bind directly to this property via TwoWay and
all is well. Now I want to create a user control that uses this class
within it, but I want to expose this DateTime dependency property sort
of like this :
public class MyUserControl : UserControl
....
public DateTime ExposedDateTimeProperty
{
get
{
return SomeClass.DateTimeProperty;
}
set
{
SomeClass.DateTimeProperty = value;
}
}
but if I try to bind to this (again, TwoWay binding) I get nothing
since ExposedDateTimeProperty is a regular CLR get/setter property and
not a dependency property. So the million dollar question is : How
does one expose a dependency property? I can't seem to find any
documention or example of this anywhere.
Regards,
Anthony
I just ran into the following scenario and couldn't figure out
something that I thought should be easy as pie.
I have a class that contains a dependency property, let's say it's a
DateTime property. I can bind directly to this property via TwoWay and
all is well. Now I want to create a user control that uses this class
within it, but I want to expose this DateTime dependency property sort
of like this :
public class MyUserControl : UserControl
....
public DateTime ExposedDateTimeProperty
{
get
{
return SomeClass.DateTimeProperty;
}
set
{
SomeClass.DateTimeProperty = value;
}
}
but if I try to bind to this (again, TwoWay binding) I get nothing
since ExposedDateTimeProperty is a regular CLR get/setter property and
not a dependency property. So the million dollar question is : How
does one expose a dependency property? I can't seem to find any
documention or example of this anywhere.
Regards,
Anthony