TextInput as EditTrigger not adding first character

18 posts, 1 answers
  1. Ingólfur
    Ingólfur avatar
    11 posts
    Member since:
    Jun 2012

    Posted 13 Feb 2013 Link to this post

    It seems that the first character entered is only handled as the EditTrigger but the actual character isn't input in the grid.

    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?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 13 Feb 2013 Link to this post

    Hello,

    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.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Ingólfur
    Ingólfur avatar
    11 posts
    Member since:
    Jun 2012

    Posted 11 Apr 2013 Link to this post

    I have 2013 Q1, would latest LIB be even newer then that?
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Apr 2013 Link to this post

    Hello,

    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.

  5. Ingólfur
    Ingólfur avatar
    11 posts
    Member since:
    Jun 2012

    Posted 15 Apr 2013 Link to this post

    Yes and still not working as I hoped it would, I might have to mess with some properties.

    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.
  6. Ingólfur
    Ingólfur avatar
    11 posts
    Member since:
    Jun 2012

    Posted 15 Apr 2013 Link to this post

    Ok I found a codesample for EditTriggers on this site and it works fine. So evidently there is something different with my code.

    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?
  7. Ingólfur
    Ingólfur avatar
    11 posts
    Member since:
    Jun 2012

    Posted 15 Apr 2013 Link to this post

    Ok I think the problem is that EditTriggers do not work properly when using GridViewMaskedTextBoxColumn. Can you confirm that this is the problem?
  8. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 Apr 2013 Link to this post

    Hello,

    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.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  9. David
    David avatar
    4 posts
    Member since:
    Mar 2013

    Posted 08 May 2013 Link to this post

    I'm using WPF Q1 2013 SP1 (still in trial) and have this problem.

    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
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 May 2013 Link to this post

    Hello,

    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. 

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Robert
    Robert avatar
    23 posts
    Member since:
    Oct 2011

    Posted 31 May 2013 Link to this post

    I have the same issue with a RadNumericUpDown in the CellEditTemplate.

    Edit: Sorry, didn't notice this was the WPF forum, my issue is in Silverlight.
  12. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 04 Jun 2013 Link to this post

    Hi Robert,

    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.

  13. Thilo
    Thilo avatar
    26 posts
    Member since:
    Feb 2011

    Posted 09 Sep 2014 in reply to Yordanka Link to this post

    I have this Problem in the newest Version 2014.2.729.45.
    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
  14. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Sep 2014 Link to this post

    Hello Thio,

    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
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  15. Anatoly
    Anatoly avatar
    3 posts
    Member since:
    Mar 2014

    Posted 27 Mar 2015 in reply to Dimitrina Link to this post

    Hello, Dimitrina.

    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?


  16. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Mar 2015 Link to this post

    Hi Anatoly,

    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.

     
  17. Anatoly
    Anatoly avatar
    3 posts
    Member since:
    Mar 2014

    Posted 31 Mar 2015 in reply to Dimitrina Link to this post

    Hi, Dimitrina.
    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.
  18. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Apr 2015 Link to this post

    Hi,

    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.

     
Back to Top