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
105
Using different editors in each cell in the column
posted

hi,

i need to use a different editor with different properties (MinValue, MaxValue, etc) for each cell in the grid

so i listen to InitializeRow event and did somthing like this

 if (e.ReInitialize) return;if (e.Row.ListObject is ProfileProperty)

{

ProfileProperty property = (ProfileProperty)e.Row.ListObject;

if (property.Type == PropertyTypeEnum.SingleValue)

{

--> CreateEditor(property, e.Row.Cells["Value"]); <--e.Row.ExpansionIndicator = ShowExpansionIndicator.Never;

}

else if (property.Type == PropertyTypeEnum.MultiValue)

{

e.Row.ExpansionIndicator = ShowExpansionIndicator.Always;

}

}

else if (e.Row.ListObject is ProfilePropertyValue)

{

ProfileProperty property = (ProfileProperty)e.Row.ParentRow.ListObject;

--> CreateEditor(property, e.Row.Cells["Value"]); <--

}

private void CreateEditor(ProfileProperty property, UltraGridCell cell)

{

switch (property.ValueType)

{

case PropertyValueTypeEnum.Boolean:

CreateBooleanEditor(property, cell);

break;case PropertyValueTypeEnum.Date:

CreateDateEditor(property, cell);

break;

case PropertyValueTypeEnum.Float:

CreateNumericEditor(property, cell);

break;
case PropertyValueTypeEnum.Integer:

CreateNumericEditor(property, cell);

break;

}

}

private void CreateNumericEditor(ProfileProperty property, UltraGridCell cell)

{

UltraNumericEditor intEditor = new UltraNumericEditor(); ((ISupportInitialize)intEditor).BeginInit();

// Set the value bounderies

if (property.Min != null) intEditor.MinValue = property.Min; if (property.Max != null) intEditor.MaxValue = property.Max;

// determine the editor data type

switch (property.ValueType)

{

case PropertyValueTypeEnum.Integer:

intEditor.NumericType = NumericType.Integer;

intEditor.MaskInput = "nnnnnnnnn";

break;

case PropertyValueTypeEnum.Float:

intEditor.NumericType = NumericType.Double;

intEditor.MaskInput = "{{double:9.3}}";break;

}

if (property.DefaultValue != null)

{

intEditor.Nullable = true;

intEditor.NullText = property.DefaultText;

}

intEditor.PromptChar =
' ';

intEditor.ReadOnly = property.ReadOnly;

intEditor.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.
MaskMode.Raw;

intEditor.MaskClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw;

intEditor.Name = property.Name + "editor";((ISupportInitialize)intEditor).EndInit();

cell.EditorControl = intEditor;

}

private void CreateDateEditor(ProfileProperty property, UltraGridCell cell)

{

UltraDateTimeEditor dateEditor = new UltraDateTimeEditor();

dateEditor.ReadOnly = property.ReadOnly;

cell.EditorControl = dateEditor;

}

private void CreateBooleanEditor(ProfileProperty property, UltraGridCell cell)

{

UltraCheckEditor boolEditor = new UltraCheckEditor();

boolEditor.Enabled = property.ReadOnly;

cell.EditorControl = boolEditor;

}

 

for each row in the grid i created an editor control and set the " Value " cell editor with that control

its workin OK but the editors dose not work as i set them to work, like the NumericEditor show me the prompt char '_' insted of ' '

and when in double numeric type the input is displayed like this ' {________ . ___ } '

am i doin something wrong?

i just cant loose those prompt chars

 

and when i use the checkbox editor its not centerd in the cell and i could not find a property witch set it centered

moshe

Parents
  • 469350
    Verified Answer
    Offline posted

     The grid column has it's own PromptChar and other mask properties. To get it to pick up the mask properties of the editor, you have to set UseEditorMaskSettings on the column to true.

Reply Children