Home Forums WinForms controls Xceed Grid for WinForms Case insensitive editing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14625 |

    I have a grid that is databound to a datatable. One of the columns in the datatable is a string. In all honesty, the string is not case sensitive, but when the user enters it is visibly distracting when the characters show up in lowercase. What I’d like to do is change the CellEditorManager so that it only displays the characters in uppercase, but I havent found a good way to do this.

    I explicitly set the CellEditorManager for the column object to an Xceed.Grid.Editors.TextBoxEditor. From there I couldnt see anything that explicitly allowed me to do what I wanted. Let me be very clear here, I’m not trying to have it mask out characters that are not uppercase, I want all characters upper or lower to be displayed as upper case characters… simply having it reject lowercase characters is not acceptable.

    So I decided I’d see what happens when it sets the control appearance. Well the editor for the cell is being managed through a WinTextBox. There doesn’t appear to be an easy way to manage this through the WinTextBox which means I’d have to set a hook to catch every character event going into and out of this control (ugg).

    Please tell me you have a simpler answer.

    Imported from legacy forums. Posted by Crackajaxx (had 2472 views)

    User (Old forums)
    Member
    Post count: 23064

    You know I could have saved myself the time by digging a little further. Its still a bit of a hack, but it works.

    private void OnSettingControlAppearance( object sender, Xceed.Grid.Editors..CellEditorEventArgs e )
    {
    Control controlObj = e.Control;
    if ( controlObj is Xceed.Editors.WinTextBox )
    {
    Xceed.Editors.WinTextBox textBox = (Xceed.Editors.WinTextBox) controlObj;
    if ( e.Cell.FieldName == “SomeField” )
    {
    textBox.TextBoxArea.CharacterCasing = CharacterCasing.Upper;
    }
    }
    }

    Imported from legacy forums. Posted by Crackajaxx (had 459 views)

    User (Old forums)
    Member
    Post count: 23064

    You should be able to do it by using the “<” character, which is not a mask character as such, but converts all input characters to lowercase (“>” converts to uppercase).

    e.g. :
    gridControl1.Columns[ 0 ].CellViewerManager = new TextViewer( “>” );
    gridControl1.Columns[ 0 ].CellEditorManager = new TextEditor( “>” );

    Imported from legacy forums. Posted by André (had 3371 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.