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
555
How to add custom control (controls which derives from System.Windows.Forms) in Infragistics wingrid column?
posted

I have a custom control "MyMaskedEditBox" which derives from "System.Windows.Forms.MaskedTextBox".

 public class MyMaskedEditBox : System.Windows.Forms.MaskedTextBox
    { ....    }

When i tried to Implement this control in UltraWinGrid, I got the error, "EditorControl property can only be set to a control that implements IProvidesEmbeddableEditor interface. at Infragistics.Win.UltraWinGrid.UltraGridColumn.set_EditorControl(Control value)".

I tried implementing as mentioned below.

MyMaskedEditBox EdtControl = new MyMaskedEditBox();

//Some Custom defined properties.
EdtControl.DecimalPlaces = true;
EdtControl.Mask = formatMask;
EdtControl.Masked = MaskType.AlphaNumeric;
EdtControl.Masklength = ((long)(0));
EdtControl.PromptChar = ' ';
EdtControl.Size = new System.Drawing.Size(100, 20);
EdtControl.ToCase = Alphabetcase.ToUpperCase;

 ultraGrid1.DisplayLayout.Bands[0].Columns[j].EditorControl = EdtControl;

I'm very new to use this UltrawinGrid and it will be really helpful if somebody let me how to do this?

Moreover, i found that there are multiple ways to add controls in ultrawingrid.

1. ultraGrid1.DisplayLayout.Bands[0].Columns[j].Style
2. Using EditorControl

What other ways to add controls and which one is the best usage as performance is concerned?

Thanks in Advance ..

Parents
  • 37774
    Verified Answer
    posted

     There is no easy way to do this, since you need to implement the IProvidesEmbeddableEditor interface, as you have seen.  There is an example of this with the RichTextEditor C# sample that ships with the NetAdvantage SDK, but I do not recommend that you go this route unless absolutely necessary.  Why not use an UltraMaskedEdit control, or simply use an InputMask on the column itself.  The Style property on the column allows you to select from a range of default editors so that you don't have to create your own, so this may be useful to you as well.

    -Matt

Reply Children