This is a migrated thread and some comments may be shown as answers.

KeyboardCommandProvider

6 Answers 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raul
Top achievements
Rank 1
Raul asked on 19 Jun 2018, 02:43 PM

Hello,

because Telerik has no editable (enter text not contained in list) combobox (and this is really sad) I'm forced to add the standard ComboBox to a gridview column:

 

            <telerik:GridViewDataColumn UniqueName="AccountName" Header="Gegenkonto" Width="250">
                <telerik:GridViewColumn.CellEditTemplate>
                    <DataTemplate>
                        <ComboBox ItemsSource="{Binding DataContext.AccountList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
                                  DisplayMemberPath="AccountName" Text="{Binding AccountName}" IsEditable="True"/>
                    </DataTemplate>
                </telerik:GridViewColumn.CellEditTemplate>
            </telerik:GridViewDataColumn>

The problem is now, that it doesn't move to the next cell when I press the Tab key while editing that column. It works perfectly an the other (telerik) columns.

 

Best Regards,

Raul

 

6 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 22 Jun 2018, 06:34 AM
Hello Raul,

Could you please take a look at the following SDK sample regarding Editable ComboBox column. Both mentioned features work as expected on our side - typing a name outside the combo list and moving focus with single tab press.

GridView SDK  Editable ComboBox

Let us know if you miss any feature in this type of column so that we can suggest a workaround or eventually proceed with RadComboBox / ComboBox in EditTemplate.

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Raul
Top achievements
Rank 1
answered on 22 Jun 2018, 01:12 PM

Hello,

thanks for your response, but I'm sorry to say that I don't like that solution. I don't like the code behind. I also don't like that all the new entered text is added to the list.

Why not a simple solution like supported by all the other tool providers? A text box to enter a text and a list box that has all the common text values that the customer don't want to enter each time it is the desired text.

This is a very simple control and a very very often needed control. Why making a simple thing complicated?

 

I would use the standard combobox but unfortunatelly it doesn't move the focus to the next cell of the row when pressing the tab key...

0
Raul
Top achievements
Rank 1
answered on 22 Jun 2018, 04:06 PM

I'm now trying to get it working with some modifications of my KeyboardCommandProvider. But trying to get the desired behaviour with the KeyboardCommandProvider is most times a pain.

if ((key == Key.Tab) && !Keyboard.IsKeyDown(Key.LeftShift) && !Keyboard.IsKeyDown(Key.RightShift)) {
    if (rowInEditMode != null) {
        commandsToExecute.Clear();
        commandsToExecute.Add(RadGridViewCommands.CommitCellEdit);
        commandsToExecute.Add(RadGridViewCommands.MoveNext);
        commandsToExecute.Add(RadGridViewCommands.BeginEdit);
    }
}

 

While editing a new row and pressing tab on the last cell it creates a new row. This is the desired behaviour.

Unfortunatelly when entering edit mode on an existing row and pressing tab on the last cell the focus jumps to another control of the window.

 

Any idea how to get it working? Already spent too much time with this issue. Something I can never explain to my customer...

0
Petar Mladenov
Telerik team
answered on 26 Jun 2018, 12:49 PM
Hi Raul,

Please find the attached project and the following setup:
<telerik:GridViewColumn.CellEditTemplate>
                       <DataTemplate>
                           <ComboBox ItemsSource="{Binding Countries, Source={StaticResource MyViewModel}}"
                                     DisplayMemberPath="Name"  
                                     SelectedValuePath="Name"                                     
                                     IsEditable="True"
                                     Text="{Binding CountryName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>
                       </DataTemplate>
                   </telerik:GridViewColumn.CellEditTemplate>

First Column of GridView shows the name of the F1 pilot's Country. When in Edit Mode, editable ComboBox with 3 available countries is available - Germany, Spain and UK. On editing you can either select one of the predefined countries or type new one (for example 'France') then press tab. The ViewModel's CountryName (property of the Pilot) will be updated on LostFocus.
Key moment is the usage of the ComboBox's Text property which does not always returns value from the ItemsSource.

I hope this is as close as possible to your scenario. If not, can you explain the main differences so that we can advice you further. Thank you in advance for your cooperation.

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Raul
Top achievements
Rank 1
answered on 26 Jun 2018, 02:21 PM

Hello,

thanks for your support. I'm currently using the xceed combobox as gridview column, which is very easy to use and makes exactly what I need. It also doesn't have the tab problem that the default combobox has.

Nevertheless, I would really like to see an editable combobox from telerik which has "suggested" values in the list - so I don't need to mix different tool kits. Like already stated this is something I very often need (and most likely other developers too). I don't like to use a lot of work arounds for such an easy task, that also doesn't deliver what is really needed.

0
Petar Mladenov
Telerik team
answered on 28 Jun 2018, 06:37 AM
Hi Raul,

In the last project from 26th of June you can simply replace the ComboBox in the template with telerik:RadComboBox and you will have the same behavior. We encourage you to use telerik controls only cause this way you will achieve consistency in styles. Changing the application theme with StyleManager or implicitly will have effect over all telerik controls and some MS controls too.

Also, we are still unable to reproduce the tab issue you have mentioned. You can elaborate what theme is applied at your side and the exact steps you do so that we can investigate it more precisely.

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Raul
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Raul
Top achievements
Rank 1
Share this question
or