Hi,
Is it possible to set the value of tri-state box to following:
0 - Unchecked
1- Checked
2- Grayed Box
3-Checked
Note: As of this moment, I can only display the Grayed Box when I set the value to DBNull.Value.
Regards,
Njel
Hi Njel,
I'm not sure I understand what you are asking. Can you explain in a little more detail?
Hi Mike,
Tri-state checkbox has three state which are the following.
Checked,Unchecked and Grayed Box.
To be able to display all of these states we have to set following values to the tri-state checkbox.
0 to display Unchecked state
1 to display Checked state
DBNull.Value to display Grayed box state.
Is it possible to set value=2 of tri-state checkbox and display Grayed Box?
Note: Grayed box is the state between checked and unchecked.
use this datafilter, and modify the yes no and return values to your suiting (I use 0, 1, -1)
Peter
class CheckEditorDataFilter : Infragistics.Win.IEditorDataFilter { object Infragistics.Win.IEditorDataFilter.Convert(Infragistics.Win.EditorDataFilterConvertArgs args) { int Yes = 1; int No = -1; int Unknown = 0;
switch (args.Direction) { case ConversionDirection.EditorToOwner: args.Handled = true; CheckState state = (CheckState)args.Value; switch (state) { case CheckState.Checked: return Yes; case CheckState.Unchecked: return No; case CheckState.Indeterminate: return Unknown; } break; case ConversionDirection.OwnerToEditor: args.Handled = true; if (args.Value == null) return CheckState.Indeterminate; int s = (int)args.Value; switch (s) { case 1: return CheckState.Checked; case -1: return CheckState.Unchecked; case 0: return CheckState.Indeterminate; } break; } throw new Exception("Invalid value passed into CheckEditorDataFilter.Convert()"); } }
Thanks for the sample code, this is exactly what I am looking for.
Thanks and regards,