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

Selecting all text in Text cell on entering edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

116537 Jun 6,2014 10:03 PM UTC Jun 11,2014 01:47 PM UTC WPF 3
loading
Tags: GridDataControl
James
Asked On June 6, 2014 10:03 PM UTC

Hello everyone,

I've been trying to figure out how to get the entire cell contents (regular text cell) to be highlighted when the user enters edit mode for the cell.

I've been able to achieve the same functionality by using the EventHandler for CurrentCellMoved as follows (but this only highlights all the text when I double click into the cell, not when I start to edit it by pressing "Tab" or "Enter")

                private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs args)
{
grid.Model.CurrencyManager.CurrentCell.BeginEdit(true);
}

Does anyone know what I can do to get the entire cell contents highlighted when it enters edit mode?

Any help is appreciated.

Thank you.

James

Ganesan V [Syncfusion]
Replied On June 9, 2014 11:32 AM UTC

Hi James,

Thank you for using Syncfusion Products.

You can highlight the cell contents when user enter into edit mode by using the ActivateCurrentCellBehavior property. Please refer the following code example :

Code Snippet[C#]:

this.dataGrid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

Please let us know if you have any queries,

Thanks,

Ganesan

 


James
Replied On June 9, 2014 10:31 PM UTC

Thanks for the code Ganesan, it helps slightly but it's not exactly what I want.

The code you provided selects all the text whenever a cell is activated, I want all the text to be selected only when the cell enters edit mode.

The reason why I ask for this is because I want the user to be able to select an entire row using the mouse without entering the edit mode. With the code you have provided the user can perform "single-click to edit" but I would like it to remain as "double-click to edit" (so that the user can single click to select the record and get right click context menu items).

Please respond.

James

Deepak Raj Sundar [Syncfusion]
Replied On June 11, 2014 01:47 PM UTC

Hai James,
You can highlight the cell contents when the user enters in edit mode by using the ActivateCurrentCellBehaviour property as shown in the following code snippet.

Code snippet[C#]:

this.dataGrid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll | GridCellActivateAction.DblClickOnCell;

 

Please let us know if you have any queries,

Regards

Deepak raj Sundar




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

;