When I have a cell selected but not in edit mode I want to write 4567in it. In excel this would work. In radgrid the original 4 keypress would enter edit mode, then 567 would be entered into the cell. How can I make it so that the 4 is both handled as a EditTrigger as well as input?
17 Answers, 1 is accepted
We believe we have recently fixed such an issue. May I ask you to download the latest LIB and test with it. Please let me know about the result.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The fix should be included in 2013 Q1. Have you tested with it?
All the best,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Are you certain it should work as I'm thinking it should?
I wan't to be out of edit mode, type in 12000 and that goes into the box, instead of 1 being the trigger and only 2000 goes into the box.
What could it possibly be. Perhaps the fact I have varied types of columns in my grid, For example I've got GridViewMaskedTextBoxColumns as the main columns where I try to change the data and also ButtonColumns and/or GridVIewDataColumn for labels.
Could that interfere in any way?
I am not able to reproduce a problem with the regular GridViewDataColumn having a TextBox as their editor. With the GridViewMaskedTextBoxColumn the behavior is observed and it is due to the specifics of the RadMaskedTextBox editor. We have plans to obsolete it and that is why I would suggest you to define a regular column and set its CellEditTemplate to be one of our Masked Input controls.
You can check our online documentation here and the MaskedTextInput WPF Demo.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The GridView has EditTriggers="Default"
Here's my column definition.
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding RequestedQty}"
Header
=
"Req Qty"
Width
=
"75"
TextAlignment
=
"Right"
HeaderTextAlignment
=
"Right"
DataFormatString
=
"n"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
telerik:RadMaskedNumericInput
Value
=
"{Binding RequestedQty, UpdateSourceTrigger=LostFocus}"
Mask
=
""
FormatString
=
"n"
HorizontalAlignment
=
"Right"
HorizontalContentAlignment
=
"Stretch"
InputBehavior
=
"Replace"
SelectionOnFocus
=
"SelectAll"
IsClearButtonVisible
=
"False"
maskedInput:MaskedInputExtensions.Minimum
=
"0"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
If a cell created using this column definition is focused but not in edit mode the first charachter entered puts it in edit mode as expected but that character is lost as stated by the OP.
Thanks,
Dave
Thank you for the code snippet.
I were able to reproduce the issue. We are aware of the problem and we are currently working on resolving it.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Edit: Sorry, didn't notice this was the WPF forum, my issue is in Silverlight.
The problem should be fixed with our latest internal build - version 2013.1.0527. Could you give it a try and let us know if you find any problems?
Regards,
Yordanka
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Is there a solution ?
I Think it has to do with SelectionOnFocus="SelectAll", but this is the only Option for me that is usable to Enter a Number Value.
Thanks,
Thilo
I tested the code snippet previously shared. The result I observed is the the first character is actually entered, it is that the entire value is selected. Therefore, the next input clears the selected value.
It is not reproducible in case I change the SelectionOnFocus setting. I understand this is the only option usable for you, however, once you select all the text and you enter a new one, the old text will be lost. This would be the expected behavior.
Regards,
Dimitrina
Telerik
I have the same problem with first character when I use UserControl as column editor with RadComboBox and RadDatePicker controls in it.
Here is the content of UserControl XAML:
<UserControl x:Class="Example1.SelectDateComboboxControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="25"/>
</Grid.ColumnDefinitions>
<telerik:RadComboBox x:Name="ComboBox" Grid.Column="0" Grid.ColumnSpan="2"
IsTextSearchEnabled="True"
IsEditable="True"
TabIndex="0"
TextSearchMode="StartsWith"
SelectAllTextEvent="None"/>
<telerik:RadDatePicker x:Name="Calendar" Grid.Column="1" DateSelectionMode="Day" Focusable="False" TabIndex="1" IsTabStop="False"/>
</Grid>
</UserControl>
I tried to set keyboard focus by calling Keyboard.Focus(ComboBox)in Loaded elent of this UserControl - no luck. ComboBox got focus but it is empty.
Here is column method for creating this UserControl editor:
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
{
var cellEditElement = new SelectDateComboboxControl();
BindingTarget = SelectDateComboboxControl.ValueProperty;
var valueBinding = CreateValueBinding();
cellEditElement.SetBinding(this.BindingTarget, valueBinding);
return cellEditElement;
}
protected virtual Binding CreateValueBinding()
{
var valueBinding = new Binding
{
Mode = BindingMode.TwoWay,
NotifyOnValidationError = true,
ValidatesOnExceptions = true,
UpdateSourceTrigger = UpdateSourceTrigger.Explicit,
Converter = GetDisplayValueConverter(),
ConverterParameter = ValueType,
Path = new PropertyPath(DataMemberBinding.Path.Path)
};
return valueBinding;
}
Here is the part of UserControl:
public partial class SelectDateComboboxControl : UserControl
{
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
"Value", typeof (string), typeof (SelectDateComboboxControl), new PropertyMetadata(default(string)));
public string Value
{
get { return (string) GetValue(ValueProperty); }
set
{
SetValue(ValueProperty, value);
ComboBox.Text = value;
}
}
...
How RadGridView determine to what control in column editor to pass entered character?
As it turns out when you have redefined the CellEditTemplate of GridViewDataColumn, then the text input over the cell prior going into edit mode will not be directly propagated to the RadComboBox element you defined as an editing element.
You can try the following work around:
private
void
pilotsGrid_PreparingCellForEdit(
object
sender, GridViewPreparingCellForEditEventArgs e)
{
TextCompositionEventArgs textCompositionEventArgs = e.EditingEventArgs
as
TextCompositionEventArgs;
if
(textCompositionEventArgs !=
null
)
{
RadComboBox comboBox = e.EditingElement
as
RadComboBox;
if
(comboBox !=
null
)
{
comboBox.Text = textCompositionEventArgs.Text;
}
}
}
Let me know how it works for you.
Regards,
Dimitrina
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Your workaround works fine, thank you. I just wondering why I cannnot get this entered value in some overrided method of my custom column class, for example in CreateCellEditElement where I create my custom editor control.
This logic is incorporated in the design of the columns and as it turns out I cannot suggest you on how to access this exact information on CreateCellEditElement instead.
Regards,
Dimitrina
Telerik
See What's Next in App Development. Register for TelerikNEXT.