Esempio n. 1
0
        public static void TrimWhenEditCell(VGridControl gridControl)
        {
            TrimFormatter formatter = new TrimFormatter();

            gridControl.ShownEditor += delegate(object sender, EventArgs e) {
                VGridControl control = sender as VGridControl;
                if (control.ActiveEditor is TextEdit && !(control.ActiveEditor is LookUpEdit))
                {
                    TextEdit myTextEdit = ((TextEdit)control.ActiveEditor);

                    if (!string.IsNullOrEmpty(myTextEdit.Text.Trim()))
                    {
                        myTextEdit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
                        myTextEdit.Properties.EditFormat.Format     = formatter;
                    }
                }
                ;
            };
        }
Esempio n. 2
0
        public static void TrimWhenEditCell(GridControl gridControl)
        {
            GridView gv = (GridView)gridControl.MainView;

            TrimFormatter formatter = new TrimFormatter();

            gv.ShownEditor += delegate(object sender, EventArgs e) {
                GridView view = sender as GridView;
                if (view.ActiveEditor is TextEdit && !(view.ActiveEditor is LookUpEdit))
                {
                    TextEdit myTextEdit = ((TextEdit)view.ActiveEditor);

                    if (!string.IsNullOrEmpty(myTextEdit.Text.Trim()))
                    {
                        myTextEdit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
                        myTextEdit.Properties.EditFormat.Format     = formatter;
                    }
                }
            };
        }