Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
818
xamGrid String Indexer question
posted

We have an application where we need to display editable properties in a grid dynamically. On our core business object, we have a collection of property name/value objects that are indexed by the property name.

We had thought the string indexer support in 10.3 would keep us from having to create custom columns in order to perform the appropriate binding. In short, we need to provide a binding path to the column in the form "Properties[KeyName].Value", but xamGrid throws an exception when this syntax is used. We have confirmed that the syntax is correct and other databinding requirements have been met by creating a custom column and specifying this path.

Due to the dynamic nature of the properties, all of the columns are added in code-behind and there is no possibility of creating corresponding properties on the core business object.

The rough classes involved are:


Public Class NameValuePair
    Public Property Name As String
    Public Property Value As String
End Class

Public Class NameValuePairCollection
    Inherits System.Collections.ObjectModel.KeyedCollection(Of StringNameValuePair)

    Protected Overrides Function GetKeyForItem(item As NameValuePairAs String
        Return item.Name
    End Function
End Class

Public Class File
    Public Properties As NameValuePairCollection
End Class