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
255
XAMDataGrid Set FieldSetting and Field LayoutSettings
posted

HI All,

Hope someone can assist me. I have a XAMDataGrid and a Combobox on my form. The combobox has 2 items. What i want to do is set the following fields:

Combo Index 0 Selected:

1. FieldSettings - CellClickAction: EnterEditModeIfAllowed

2. FieldLayoutSettings - SelectionTypeCell: Single

Combo Index 1 Selected:

1. FieldSettings - CellClickAction: SelectCell

2. FieldLayoutSettings - SelectionTypeCell: ExtendedAutoDrag

When I set the value in code behind I get the following error: "Exception has been thrown by the target of an invocation." 

FieldSettings set = testGrid.FieldSettings;
FieldLayoutSettings lay = testGrid.FieldLayoutSettings;

if (matrixTuningComboBox.SelectedIndex == 1)
{
set.CellClickAction = CellClickAction.SelectCell;
lay.SelectionTypeCell = Infragistics.Windows.Controls.SelectionType.ExtendedAutoDrag;
}
else
{
set.CellClickAction = CellClickAction.EnterEditModeIfAllowed;
lay.SelectionTypeCell = Infragistics.Windows.Controls.SelectionType.Single;
}

testGrid.FieldSettings = set;
testGrid.FieldLayoutSettings = lay;

Please see the attachment.

Sample.zip

Friendly Regards,

Roelof