<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> |
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();
}
} |
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. |
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,