
Namespace Primitives

    ''' <summary>
    ''' Provides data for a collection changed event.
    ''' </summary>
    ''' <remarks></remarks>
    Public Class CollectionChangedEventArgs

        Private _propertyName As String
        Private _index As Integer = -1
        Private _action As CollectionChangedAction

        ''' <summary>
        ''' Initializes a new instance of the <see cref="Mercury.Mobile.Forms.Primitives.CollectionChangedEventArgs"/> 
        ''' class with the specified values.
        ''' </summary>
        ''' <param name="index">The index of the item that was affected.</param>
        ''' <param name="change">The change action that occurred.</param>
        Public Sub New(ByVal index As Integer, ByVal change As CollectionChangedAction)
            Me.New(index, change, Nothing)
        End Sub

        ''' <summary>
        ''' Initializes a new instance of the <see cref="Mercury.Mobile.Forms.Primitives.CollectionChangedEventArgs"/> 
        ''' class with the specified values.
        ''' </summary>
        ''' <param name="index">The index of the item that was affected.</param>
        ''' <param name="change">The change action that occurred.</param>
        ''' <param name="propertyName">The name of the item or property that was affected.</param>
        Public Sub New(ByVal index As Integer,ByVal change As CollectionChangedAction, ByVal propertyName As String)
            Me._index = index
            Me._action = change
            Me._propertyName = propertyName
        End Sub

        ''' <summary>
        ''' Gets the index of the change item.
        ''' </summary>
        ''' <returns>The index of the changed item.</returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Index() As Integer
            Get
                Return Me._index
            End Get
        End Property

        ''' <summary>
        ''' Gets the name of the changed item or property, if available.
        ''' </summary>
        ''' <returns>The name of the changed item or property.</returns>
        Public ReadOnly Property PropertyName() As String
            Get
                Return Me._propertyName
            End Get
        End Property

        ''' <summary>
        ''' Gets the change action that occurred.
        ''' </summary>
        ''' <returns>The change action that occurred.</returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Action() As CollectionChangedAction
            Get
                Return Me._action
            End Get
        End Property

    End Class

End Namespace