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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Suppress enter key with griddatacontrol?

Thread ID:





108397 Apr 18,2013 07:58 AM UTC Jun 3,2013 11:42 AM UTC WPF 3
Tags: GridControl
Sören Höglund
Asked On April 18, 2013 07:58 AM UTC


I want to suppress the default enter key behavior. From what I can tell, the regular gridcontrol has a WantEnterKey property that can be set to false, but how can I accomplish the same thing with a GridDataControl?


Gobinath A [Syncfusion]
Replied On May 7, 2013 02:43 PM UTC

HI Sören,

Thanks for using Syncfusion products.

We have analyzed your query and In GridDataControl don’t have the WantEnterKey property but if you want to suppress the enter key then you can achieve your requirement by using PreviewKeyDown event as below the code snippet.

Code snippet[C#]:


this.SyncGrid.PreviewKeyDown += new KeyEventHandler(SyncGrid_PreviewKeyDown);



void SyncGrid_PreviewKeyDown(object sender, KeyEventArgs e)


            if (Key.Enter == e.Key)


                e.Handled = true;




Please let us know if you have any queries.



Gobinath A.


Sören Höglund
Replied On May 10, 2013 12:45 PM UTC

My specific use case was a bit more complex: I have a textbox in a detail view that accepts new lines, so I can't just mark the event as handled.

Manually adding newlines to the control using the preview key event is how I ended up handling it, and that works, but it's not exactly a neat solution.

Gobinath A [Syncfusion]
Replied On June 3, 2013 11:42 AM UTC

Hi Sören,


Sorry for the delay in getting back to you.


We have analyzed your query and you can achieve your requirement by using below the code snippet for multiline option.


Code snippet[XAML]:


<syncfusion:GridDataVisibleColumn MappingName="Quantity">


        <syncfusion:GridDataColumnStyle AcceptsReturn="True"/>





We have prepared sample based on your requirement and please find the sample under the following location.


Sample: GridDataControl.zip


Please let us know if you have any queries.




Gobinath A.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon