Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: CollectionControl binding

$
0
0
I have added a different class type, clsMaterial2, in CollectionControl1.NewItemTypes.

where
Public Class clsMaterial2

    Implements INotifyPropertyChanged

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Public Sub OnPropertyChanged(ByVal e As PropertyChangedEventArgs)
        If Not PropertyChangedEvent Is Nothing Then
            RaiseEvent PropertyChanged(Me, e)
        End If
    End Sub

    Public myProperty3 As Double
    Public myDisplayedName As String


    Public Sub New()
        myDisplayedName = "DefaultName"
        myProperty3 = 0.0

    End Sub

    Public Sub New( _
           ByVal newDisplayedName As String,
           ByVal newProperty3 As Double
           )

        myDisplayedName = newDisplayedName
        myProperty3 = newProperty3

    End Sub

    Public Property DisplayedName() As String
        Get
            Return myDisplayedName
        End Get
        Set(ByVal value As String)
            myDisplayedName = value
        End Set
    End Property

    Public Property Property3() As Double
        Get
            Return myProperty3
        End Get
        Set(ByVal value As Double)
            myProperty3 = value
        End Set
    End Property


End Class
Then when the PersistChanges routine is invoked I get the following error:

The value "clsMaterial2" is not of type "clsMaterial" and cannot be used in this generic collection.
Parameter name: value

Is there a way round this?

(I will raise an issue regarding the MoveUp/MoveDown events - Thanks)

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>