Hello,
I have a object that looks like this: SomeObject<T>, and a list of "SomeObject" objects, all of which have different types of T (int, double, string, etc).
SomeObject.Value return value of type T.
1. Can I use the XamDataGrid in a way that allows me to have a bound column with a flexible type? (to display the value property)
2. If so, can I select the editor type for different cells in a single column? for example, in the 3rd row I want a string editor, while in 4th row I want a MaskedEditor to handle doubles well.
Thank you.
Never mind, found it, thank you.
Hello Alex, Thank you for the quick answer.
I am aware of the editor types per column, what I'm talking about is editor types per row and column, as you mentioned in part 2.
Where exactly in InitializeRecord can I manually assign an editor to a specific cell in a column? I couldn't find anything on e.Record.
Thanks again.
1). Yes. Each field exposes properties like EditorStyle, EditorType, EditAsType.
1.1 For EditorStyle you can create a style, which TargetType would be the same as the underlying editor.
1.2 For EditorType, you can directly specify which type of editor you want to use for that field.
1.3 For EditAsType, you can choose how the data would be interpreted. If you set only this, the default value editor for a particular type would be automatically assigned. For example - for string type - XamTextEditor, for integer/double - XamNumericEditor, for decimal - XamCurrencyEditor, for DataTime - XamDataTimeEditor, for boolean - XamCheckEditor.
2). Again the same as 1. You can specify the underlying value editor for each column individually. If you do not do this, the XamDataGrid will pick the default editor for that value type. This is how you assign editors per column (field). If you want to do this per record, you can use the InitializeRecord event and there manually assign editor/editor type/editor style to the cells of this particular record.
Hope this helps.