I have a grid (Silverlight3 built-in) where I build all the columns dynamically by setting the itemssource to a dictionary object. I bind all columns to the same property and then use converters with converter parameter to fetch the correct value from the dictionary.
I want to use the same solution but just with your grid (XamWebGrid). I'm not very familiar yet with your grid so I may be doing things completely the wrong way. I used the Key property of the TextColumn to "bind" the column to a certain property. This works fine first time but on second column I get an error that I must have unique Key names.
Is it possible for me to bind all columns to the same property? I found the ValueConverter and ValueConverterParameter properties of the TextColumn which I can use to achieve the rest of my requirements.
I need to do all of this on code as the columns are dynamic on this case. I think I saw a discussion somewhere stating that I can't do the template on code behind and I would have to use XAML for that which is a showstopper for me.
Hi,
Yes, but you'd need to use the TemplateColumn, instead of the TextColumn. In which case, you would use the ItemTemplate property, and provide a DataTemplate, with your Binding and Converter:<DataTemplate> <TextBlock Text={Binding Prop, Converter={StaticResource MyConverter}, ConverterParameter=Test}/> </DataTemplate>
Then, for each column, you would provide a unique key, as the key on a TemplateColumn doesn't require a link between the underlying data.
-SteveZ