Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Set a DependencyProperty to an Interface???
3 replies. Latest Post by ckiszka@msn.com on November 25, 2008.
(0)
ckiszka@...
Member
11 points
34 Posts
11-23-2008 6:35 PM |
I have declared a dependency property and want to set its value to an interface. I am geting a parser error. Is what I am trying to acomplish possible in Silverlight 2? If so, how would I go about doing it?
Thanks :)
warriors89
21 points
7 Posts
11-23-2008 7:27 PM |
What do you mean by "set its value to an interface", can you elaborate any further?
An interface could mean a lot of things :)
11-23-2008 7:55 PM |
Composition. Say I created a dependency property "Vehicle" and want to set its type to IVehicle.
11-25-2008 9:12 AM |
Here is an example.
Public Shared ReadOnly VehicleProperty As DependencyProperty = DependencyProperty.Register("Vehicle", GetType(IVehicle), GetType(MyClass), New Windows.PropertyMetadata(Nothing)) Public Property Vehicle() As IVehicle Get Return GetValue(VehicleProperty) End Get Set(ByVal value As IVehicle) SetValue(VehicleProperty, value) End Set End Property