In Silverlight, add custom property to a generated Linq class + manage events
I'm using Linq to SQL classes in my WCF. Those classes are returned from the WCF methods to the Silverlight. Now, I want to add a custom property on a the generated class (Silverlight side) and trigger a PropertyChangedEvent on that particular property, based on another PropertyChangedEvent from another property. To be clear, here's a piece of code that doesn't work :
<code><pre>
    Partial Public Class DataConnection    
            Public Sub New()
                AddHandler Me.PropertyChanged, AddressOf _PropertyChanged
            End Sub

            Private Sub _PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
                If e.PropertyName = "ConnectionType" Then
                    Me.RaisePropertyChanged("ConnectionTypeEnum")
                End If
            End Sub

            Private _ConnectionTypeEnum As String
            Public ReadOnly Property ConnectionTypeEnum() As String
                Get
                    Select Case Me.ConnectionType
                        Return //Something based on ConnectionType //
                    End Select
                End Get
            End Property
    
           
        End Class
</pre></code>
The problem is that the code in New() is never executed, so I never know when the ConnectionType is changed, so I can't trigger the PropertyChanged on ConnectionTypeEnum. (this property is used a in One-Way binding so I need it)

Does anyone have a solution for this ?

Thanks
In Silverlight, add custom property to a generated Linq class + manage events
===

I'm using Linq to SQL classes in my WCF. Those classes are returned from the WCF methods to the Silverlight. Now, I want to add a custom property on a the generated class (Silverlight side) and trigger a PropertyChangedEvent on that particular property, based on another PropertyChangedEvent from another property. To be clear, here's a piece of code that doesn't work :
<code><pre>
    Partial Public Class DataConnection    
            Public Sub New()
                AddHandler Me.PropertyChanged, AddressOf _PropertyChanged
            End Sub

            Private Sub _PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
                If e.PropertyName = "ConnectionType" Then
                    Me.RaisePropertyChanged("ConnectionTypeEnum")
                End If
            End Sub

            Private _ConnectionTypeEnum As String
            Public ReadOnly Property ConnectionTypeEnum() As String
                Get
                    Select Case Me.ConnectionType
                        Return //Something based on ConnectionType //
                    End Select
                End Get
            End Property
    
           
        End Class
</pre></code>
The problem is that the code in New() is never executed, so I never know when the ConnectionType is changed, so I can't trigger the PropertyChanged on ConnectionTypeEnum. (this property is used a in One-Way binding so I need it)

Does anyone have a solution for this ?

Thanks