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.

How to not show keyboard when user touch on the manual input area ?

Thread ID:

Created:

Updated:

Platform:

Replies:

128583 Jan 30,2017 11:10 AM Feb 15,2017 10:56 PM WinRT 10
loading
Tags: SfDataGrid
Nicolas
Asked On January 30, 2017 11:10 AM

Hi,

In your Windows application, user can select value using NumericUpdown control.
Users never need to use the keyboard to enter a value.

Sometimes, User touche the input area rather than "+" or "-" button, then the keyboard appears.

1) Is it possible to not show keyboard if user touch this area by mystake ?
2) Exceptionaly, If user needs the keybord for this control, is it possible to let the option to the user to show the keyboard ?

Regards,

Priyanga Balasubramaniam [Syncfusion]
Replied On January 31, 2017 08:15 AM

Hi Nicolas,

Thank you for contacting Syncfusion support.

We have checked your query there is no direct property to avoid keyboard appearance when user touch on the text area of SfNumericUpDown control.

We have prepared the workaround sample. In this sample, we have provided attached property "Keypad.EnableKeypad" in sample level and set its value to "False" to avoid the keypad appearance when user touch on the text area.

Also, we fetched SfNumericTextBox using VisualTreeHelper and set "IsHitTestVisible" property to False by assigning "Keypad.EnableKeypad" property value.

Please download the sample from the below location and let us know whether the sample meets your requirement?

Sample:WinrtTestSample

Regards,
Priyanga B


Nicolas
Replied On February 2, 2017 12:17 PM

Hi,

Thanks for your answer.

You sample didn't build.

Your tips don't work.
I use Win 8.1.
Keyboard always appears.

Have you another tips to do that ?

Regards,

Priyanga Balasubramaniam [Syncfusion]
Replied On February 4, 2017 06:19 AM

Hi Nicolas,

We have checked last attached sample in windows 8.1 machine. We can run the sample and keyboard did not appear when we touch on the text area. For more detail please refer the below video.

Video: Video

Could you please share the below details which could help us to proceed further on this?

1) Your current version of Essential Studio
2) What type of error occurs while running our sample?

Regards,
Priyanga B


Nicolas
Replied On February 7, 2017 09:22 AM

Thanks,

It is worked, sorry.

I should add a precision.
This a is in grid with a sfnumericupdown colonn.
I get the sfnumerictextbox, but i can't add the attribute.

Gnanasownthari Thirugnanam [Syncfusion]
Replied On February 8, 2017 11:03 PM

Hi Nicolas, 
 
We have analyzed your query, you can achieve your requirement “not show keyboard when user touch on the manual input area in GridUpDownColumn” by create custom GridUpDownColumnExt with EnableKeypadProperty dependency property and customize the GridCellUpDownRendererExt class as like below code sample. 
 
XAML 
<syncfusion:SfDataGrid x:Name="grid" 
                               Grid.Row="1" 
                               AllowEditing="True" 
                               AllowFiltering="True" 
                               AllowSorting="True" 
                               AutoExpandGroups="True" 
                               AutoGenerateColumns="False" 
                               ColumnSizer="Auto" 
                               EditTrigger="OnTap" 
                               ItemsSource="{Binding OrderInfoCollection}"> 
            <syncfusion:SfDataGrid.Columns> 
                <syncfusion:GridTextColumn HeaderText="Order  id" MappingName="OrderID" /> 
                <syncfusion:GridTextColumn HeaderText="Customer id" MappingName="CustomerID" /> 
                <syncfusion:GridTextColumn HeaderText="Customer Name" MappingName="CustomerName" /> 
                <syncfusion:GridTextColumn HeaderText="Country" MappingName="Country" /> 
                <syncfusion:GridTextColumn HeaderText="Ship City" MappingName="ShipCity" /> 
                <local:GridUpDownColumnExt EnableKeypadProperty="False" HeaderText="OrderScore" 
                                             MappingName="OrderScore.StepValue" 
                                             MaxValue="500" 
                                             MinValue="0"/> 
            </syncfusion:SfDataGrid.Columns> 
        </syncfusion:SfDataGrid> 
 
C# 
this.grid.CellRenderers.Remove("UpDown");            
this.grid.CellRenderers.Add("UpDown", new GridCellUpDownRendererExt()); 
 
public class GridUpDownColumnExt : GridUpDownColumn 
{ 
    public GridUpDownColumnExt() { } 
 
    public bool EnableKeypadProperty 
    { 
        get { return (bool)GetValue(EnableKeypadPropertyProperty); } 
        set { SetValue(EnableKeypadPropertyProperty, value); } 
    } 
 
    // Using a DependencyProperty as the backing store for EnableKeypadProperty.  This enables animation, styling, binding, etc... 
    public static readonly DependencyProperty EnableKeypadPropertyProperty = 
        DependencyProperty.Register("EnableKeypadProperty", typeof(bool), typeof(GridUpDownColumnExt), new PropertyMetadata(false)); 
 
} 
 
public class GridCellUpDownRendererExt : GridCellUpDownRenderer 
{ 
    bool enableKeypadProperty; 
    public GridCellUpDownRendererExt() { } 
        
    protected override void OnEditElementLoaded(object sender, RoutedEventArgs e) 
    {             
        var sfNumericUpDown = ((SfNumericUpDown)sender); 
        SfNumericTextBox sfNumericTextBox = (SfNumericTextBox)GridUtil.FindDescendantChildByType(sfNumericUpDown, typeof(SfNumericTextBox)); 
        sfNumericTextBox.IsHitTestVisible = enableKeypadProperty; 
        var uiElement = ((SfNumericUpDown)sender); 
        uiElement.ValueChanged += OnValueChanged; 
        double value = double.MinValue;           
        if (PreviewInputText != null) 
        { 
            double.TryParse(PreviewInputText.ToString(), out value); 
            uiElement.Value = value; 
        } 
        PreviewInputText = null;           
    } 
    private void OnValueChanged(object sender, ValueChangedEventArgs e) 
    { 
        base.CurrentRendererValueChanged(); 
    } 
} 
 
We have prepared sample as per your requirement, you can download the same from below mentioned location. 
 
Sample location. 
 
Regards, 
Gnanasownthari T. 
 
 


Nicolas
Replied On February 10, 2017 08:35 AM

Thanks.

But here, the textbox is not available.
So, it will not possible to set something on the textbox with the real keyboard.

I will explain the algorithm,, but with your method you use systematically  the "loaded" event, and I thought this is not usable for us.
We should use an event like "tapped".

The alogrithm that we would like to implement for ours users :
- sfnumericupdown column is loaded

- if user tappe on the sftextbox of the sfnumericupdown
- currently : keypad appears
- we would like : keypad doesn't appear
=> with your solution it is ok, cells and sftextbox can be modified

- if user click with the mouse on sftextbox  of the sfnumericupdown
- sftextbox value can be modified
=> with your solution is KO.

Have you another id ?

Thanks,

Srinivasan Vasu [Syncfusion]
Replied On February 13, 2017 10:49 PM

Hi Nicolas, 
 
 
 
Query 1: 
[Keyboard appear disable] 
In WinRT Application, the reported behaviour is the default for Editor controls. You can see the same kind of behaviour “ On Screen Keyboard Pop ups” on touch screen mode when you use the MS TextBox. But we cannot restrict like hiding the On Screen Keyboard when it pop ups through programmatically and please refer the below MSDN link for more information,

https://social.msdn.microsoft.com/Forums/en-US/04370e8d-c374-494c-97d9-713c460ad0e5/hide-surface-rt-virtual-keyboard-by-programatically?forum=winappswithcsharp 

 
 

Query 2: 
[sftextbox value can be modified] 
We are not able to understand your query clearly. Could you please provide more details about your requirement? It will be helpful to provide better solution. 
 
 
Regards, 
Srinivasan             
 


Nicolas
Replied On February 14, 2017 11:59 AM

Hi,

What don't you understand in my algorithm ?


So, I would like edit the numeric updown value with :

- real keybord

- plus and minus button

So, never with keypad.


With some research, I find a trick with SfNumericUpDown without the sfgrid.

I find the sfNumericTextbox on the sfNumericUpdown with your way, and add an Handler to the sfnumerictextbox, on the loaded event :


With your firs sample without grid :


public MainPage()

{

this.InitializeComponent();

numericupdown.Loaded += Numericupdown_Loaded;

}


private void Numericupdown_Loaded(object sender, RoutedEventArgs e)

{

SfNumericUpDown numericupdown = sender as SfNumericUpDown;

numerictextbox = FindDescendant2(numericupdown);

numerictextbox.AddHandler(TappedEvent, new TappedEventHandler(numerictextbox_Tapped), true);

}


And I manage the keypad directly on the numerictextbox_Tapped.


But with the sfGrid, I can't succeed to set the TappedEventHandler to the sfNumericTextBox.


public class GridCellUpDownRendererExt : GridCellUpDownRenderer

{

bool enableKeypadProperty;

public GridCellUpDownRendererExt() { }


protected override void OnEditElementLoaded(object sender, RoutedEventArgs e)

{

var sfNumericUpDown = ((SfNumericUpDown)sender);

SfNumericTextBox sfNumericTextBox = (SfNumericTextBox)GridUtil.FindDescendantChildByType(sfNumericUpDown, typeof(SfNumericTextBox));

sfNumericTextBox.AddHandler(TappedEvent, ....)

...


I have the following message : TappedEvent doesn't exist in the current context (this is a transalation from french, I don't have the English message).

Have you an idea to add the TappedEventHandler on the sfNumericTextBox on the column of sfGrid with sfNumericTextBox ?


Thanks for your help,






Nicolas
Replied On February 15, 2017 07:52 AM

I just change the TappedEvent by UIElement.TappedEvent :(.
Mabe I was little tired.
It seems ok.

If I met another issue, I will reply on this topic.
Thanks,

Gnanasownthari Thirugnanam [Syncfusion]
Replied On February 15, 2017 10:56 PM

Hi Nicolas, 

Thank you for your update. 

Please let us know if you need any other assistance and we will be happy to assist you. 

Regards, 
Gnanasownthari T. 


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.

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.

;