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

EditTrigger="OnTap" similar property for using arrow keys

Thread ID:

Created:

Updated:

Platform:

Replies:

119601 Jul 13,2015 08:25 PM UTC Jul 29,2015 05:04 AM UTC WinRT 11
loading
Tags: SfDataGrid
Vasanth
Asked On July 13, 2015 08:25 PM UTC

Hi,

In SfDataGrid, using EditTrigger="OnTap" sets the Clicked or Tapped cell to Edit mode automatically. Is there any property available to achieve as behavior when using arrows to navigate arrows cells? 

Vasanth

Jai Ganesh S [Syncfusion]
Replied On July 14, 2015 12:47 PM UTC

Hi Vasanth,


Thank you for using Syncfusion products.


We have analyzed your query. You can achieve your requirement by wiring CurrentCellActivated event and call the BeginEdit () method.


Code Snippet [C#]:


void datagrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args)

{

    this.datagrid.SelectionController.CurrentCellManager.BeginEdit();

}



We have also prepared the sample based on this and please find the sample under the following location,


Sample:

http://www.syncfusion.com/downloads/support/directtrac/139935/ze/SfDataGridDemo1471600134


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


 


Vasanth
Replied On July 15, 2015 01:44 AM UTC

Perfect, thank you!

Saranya CJ [Syncfusion]
Replied On July 15, 2015 04:09 AM UTC

Hi Vasanth,

Thank you for your update. Please let us know if you require any other assistance.

Regards,
Saranya

Vasanth
Replied On July 16, 2015 08:06 PM UTC

Hi,
This workaround works well when the rows are visible. But if there is a scroll bar and if you use down arrow to navigate to rows below the visible portion it doesnt trigger the EditMode. Please let me know if you need a sample.

Thanks,
Vasanth

Jai Ganesh S [Syncfusion]
Replied On July 20, 2015 01:06 PM UTC

Hi Vasanth,


Sorry for the inconvenience caused.


We have analyzed your query. When we scroll the rows, the rows are reusable and we cannot find the reusable rows. Also we cannot be set to the current cell to that row. Hence the EditMode is not triggered for the invisible rows. However you can achieve your requirement by calling the BeginEdit () inside the Dispatcher,


Code Snippet [C#]:


async void datagrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args)

        {

            await datagrid.Dispatcher.RunIdleAsync(result =>

            {

                datagrid.SelectionController.CurrentCellManager.BeginEdit();

            });

        }


We have also prepared the sample based on this and please find the sample in the following location:


Sample:

http://www.syncfusion.com/downloads/support/directtrac/133738/ze/SfDataGridDemo-1016976433


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


Vasanth
Replied On July 21, 2015 06:23 PM UTC

Thanks Jai Ganesh, there is another minor issue I am not sure if its a feature or issue. Please let me know.

So now when using Arrows its correctly changing the cells to Edit mode and highlights whole cell text. 
1. Press down arrow, it highlights cell value 
2. Press down arrow again, it puts the cursor in the end of cell value.
repeat steps 1 and 2 it navigates to next row and continues to highlight cell value
-- Which is correct.

But if you press Up arrow, it puts the cursor to the front of cell value. Is it possible to make it place the cursor in the end of cell value or is that a feature of Up arrow?

Thanks,
Vasanth

Jai Ganesh S [Syncfusion]
Replied On July 23, 2015 01:13 AM UTC

Hi Vasanth,

Sorry for the inconvenience caused.
 
We have analyzed your query. You can achieve your requirement by setting the “EditorSelectionBehavior” property as MoveLast in SfDataGrid.

Code Snippet [C#]:

<Grid:SfDataGrid x:Name="datagrid"  

                         AutoGenerateColumns="False"

                         ItemsSource="{Binding GDCSource}"

                         AllowResizingColumns="True"

                         AllowResizingHiddenColumns="True"

                         EditorSelectionBehavior="MoveLast"

                         EditTrigger="OnTap"

                         AllowEditing="True"

                         ShowRowHeader="True" 
                         ColumnSizer="Auto">/>


We have also modified the sample based on this and please find the sample from the following location,

Sample:
http://www.syncfusion.com/downloads/support/directtrac/141699/ze/SfDataGridDemo-1505507800

Please let us know if you need further assistance.

Thank you,
Jai Ganesh S

Vasanth
Replied On July 23, 2015 05:22 PM UTC

Hi Jai Ganesh,

If I use the "EditorSelectionBehavior="MoveLast"" I will loose the feature which highlights cell on Edit. I am expecting same behavior of cursor placement when using Up arrow similar to Down Arrow.

Current Behavior for down arrow:
1. Press Down Arrow.
2. Cell Value is highlighted.
3. Press Down Arrow.
4. Cursor is placed in right corner.

Current Behavior for Up arrow:
1. Press Up Arrow.
2. Cell Value is highlighted.
3. Press Up Arrow.
4. Cursor is placed in left corner.
So for Case 4 I am wondering if there is anyway cursor can be placed in right corner similar to Down arrow. I dont want to loose the highlight feature. Please let me know.

Thanks,
Vasanth



Jai Ganesh S [Syncfusion]
Replied On July 28, 2015 02:03 AM UTC

Hi Vasanth,


Thank you for the update.


We have analyzed your query. When we pressing UP arrow cursor is placed in left corner. This is the default behavior in WinRT. However you can achieve your requirement through work around by customizing the GridCellTextBoxRenderer.


Code Snippet [C#]:


public class GridTextBoxRendererExt : GridCellTextBoxRenderer

        {

            int keyCount = 0;

            protected override void OnWireEditUIElement(TextBox uiElement)

            {

                uiElement.KeyUp += uiElement_KeyUp;

                keyCount = 0;

            }


            void uiElement_KeyUp(object sender, KeyRoutedEventArgs e)

            {

                if (e.Key == Key.Up && keyCount == 0)

                {

                    (sender as TextBox).SelectionLength = (sender as TextBox).Text.Length;

                    keyCount++;

                }

                else if (e.Key == Key.Up && keyCount == 1)

                {

                    (sender as TextBox).SelectionStart = (sender as TextBox).Text.Length;

                }

            }

        }


We have also prepared the sample based on this and please find the sample under the following location,


Sample: http://www.syncfusion.com/downloads/support/directtrac/139935/ze/SfDataGridDemo-2147351648


Please refer the following Kb link to show how to override the renderer,


KB Link: http://www.syncfusion.com/kb/4020/how-to-customize-the-edit-mode-behavior-of-gridnumericcolumns-cell-in-sfdatagrid


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


Vasanth
Replied On July 28, 2015 05:22 PM UTC

Great, thank you!

Jai Ganesh S [Syncfusion]
Replied On July 29, 2015 05:04 AM UTC

Hi Vasanth,

Thank you for the update.

Please let us know if you need further assistance on this.

Thank you,
Jai Ganesh S

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

;