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 StringEnd Class Public Class NameValuePairCollection Inherits System.Collections.ObjectModel.KeyedCollection(Of String, NameValuePair) Protected Overrides Function GetKeyForItem(item As NameValuePair) As String Return item.Name End FunctionEnd Class Public Class File Public Properties As NameValuePairCollectionEnd Class
Sorry about that dumb mistake; I'm quite new to styling in silverlight, so don't have my head completely wrapped around it yet.
So the TargetType needs to be a TextBox for a TextColumn.
It's not a property for styling cells. It's a property for styling the editor within.
Sorry, I meant to include that, but got distracted. Here is the style:
<Style x:Key="Standard" TargetType="ig:CellControl"> <Setter Property="Padding" Value="0"/> </Style>
What i mean is what control are you targeting for your style?
<Style TargetType=" ? "/>
For a TextColumn you need to be targeting a TextBox for the EditorStyle
-SteveZ
We we applying it to all column types, but the exception that I provided was for a TextColumn.