Completed
Last Updated: 21 Oct 2015 13:48 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 21 Aug 2014 08:19
Category: GridView
Type: Bug Report
0
FIX. RadGridView - the RadTextBoxEditor is empty when the Multiline property is set to true and the Padding is removed
To reproduce: use the following code snippet and refer to the attached sample gif file. When you enter edit mode for the first time, the editor is empty. Each next entering edit mode displays the respective text in the editor, although it is cut off.

public Form1()
{
    InitializeComponent();

    radGridView1.Font = new Font("Segoe UI", 18.0f);
    radGridView1.CellEditorInitialized += pgGrid_CellEditorInitialized; 
    AddColumns();
    radGridView1.DataSource = BuildDummyTable();
    radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;   
}

private void pgGrid_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
    if (editor != null)
    {
        ((RadTextBoxEditorElement)editor.EditorElement).TextBoxItem.Multiline = true;
        ((RadTextBoxEditorElement)editor.EditorElement).Padding = new Padding(0);
    }
}

private void AddColumns()
{
    GridViewTextBoxColumn colA = new GridViewTextBoxColumn("colA");
    radGridView1.Columns.Add(colA);
    GridViewTextBoxColumn colB = new GridViewTextBoxColumn("colB");
    radGridView1.Columns.Add(colB);
    GridViewTextBoxColumn colC = new GridViewTextBoxColumn("colC");
    radGridView1.Columns.Add(colC);
    GridViewTextBoxColumn colD = new GridViewTextBoxColumn("colD");
    radGridView1.Columns.Add(colD);
}

private DataTable BuildDummyTable()
{
    DataTable table = new DataTable();
    
    table.Columns.Add("colA");
    table.Columns.Add("colB");
    table.Columns.Add("colC");
    table.Columns.Add("colD");

    table.Rows.Add("value 1A", "value 1B", "value 1C", "value 1D");
    table.Rows.Add("value 2A", "value 2B", "value 2C", "value 2D");
    table.Rows.Add("value 3A", "value 3B", "value 3C", "value 3D");

    return table;
}
Attached Files:
0 comments