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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Suppress enter key with griddatacontrol?

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hi,

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?


-Sören

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.

 

Regards,

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:GridDataVisibleColumn.ColumnStyle>

        <syncfusion:GridDataColumnStyle AcceptsReturn="True"/>

     </syncfusion:GridDataVisibleColumn.ColumnStyle>

</syncfusion:GridDataVisibleColumn>

 

 

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.

 

Regards,

 

Gobinath A.


CONFIRMATION

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.

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

;