Skip to main content

Microsoft Silverlight

Set a DependencyProperty to an Interface???RSS Feed

(0)

ckiszka@msn.com
ckiszka@...

Member

Member

11 points

34 Posts

Set a DependencyProperty to an Interface???

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 :)

Christopher Kiszka

“Somewhere someone is practicing,
if you're not and you should meet, you will lose…”

warriors89
warriors89

Member

Member

21 points

7 Posts

Re: Set a DependencyProperty to an Interface???

What do you mean by "set its value to an interface", can you elaborate any further?

An interface could mean a lot of things :)

ckiszka@msn.com
ckiszka@...

Member

Member

11 points

34 Posts

Re: Re: Set a DependencyProperty to an Interface???

Composition. Say I created a dependency property "Vehicle" and want to set its type to IVehicle.

Christopher Kiszka

“Somewhere someone is practicing,
if you're not and you should meet, you will lose…”

ckiszka@msn.com
ckiszka@...

Member

Member

11 points

34 Posts

Re: Re: Set a DependencyProperty to an Interface???

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
  Thanks

 

Christopher Kiszka

“Somewhere someone is practicing,
if you're not and you should meet, you will lose…”
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities