We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multiline Textbox

Hi all togehter,

i have the following XAML in my Grid:

<Syncfusion:GridTemplateColumn HeaderText="Beschreibung" TextWrapping="Wrap"  MappingName="Description">
                            <TextBlock Text="{Binding Description}"  TextWrapping="Wrap" />
                            <TextBox Text="{Binding Description, Mode=TwoWay}"

I calculate the RowHight with:


Code is from google and the forum here..

Display the Multilie Text works as expected.

What i need to have is:

A editable textbox, with the possiblity to add new lines with the <CR> Key.

Thanks in advance


3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team April 10, 2017 07:17 AM UTC

Hi Peter, 
Thank you for contacting Syncfusion support. 
We have analyzed your query. You can achieve your requirement by overriding the ProcessKeyDown event in GridCellSelectionController class. By default, in the SfDataGrid on pressing the Enter key, the currentcell is moved to the next row, you can overcome this problem by setting KeyEventArgs.Handled as false in ProcessKeyDown event. For your reference, we have added the code snippet and sample in below location. Could you please refer to it. 
Code Snippet: 
this.datagrid.SelectionController = new GridCellSelectionControllerExt(datagrid); 
public class GridCellSelectionControllerExt : GridCellSelectionController 
    public GridCellSelectionControllerExt(SfDataGrid dataGrid) 
    : base(dataGrid) 
    protected override void ProcessKeyDown(KeyEventArgs args) 
        if (args.Key == Key.Enter) 
            args.Handled = false; 
Please let us know if you have any query. 
Muthukumar K 

FP Forstmeier Peter April 10, 2017 06:09 PM UTC

Hi and thanks a lot.
Your example works perfectly.

MK Muthukumar Kalyanasundaram Syncfusion Team April 11, 2017 05:05 AM UTC

Hi Peter, 
You are welcome. Please let us know if you need any other assistance. 
Muthukumar K 

Live Chat Icon For mobile
Up arrow icon