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

Tabbing GridViewDataColumn

5 Answers 136 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 14 Oct 2014, 11:30 AM
I'm using a RadGridview with 2 columns of GridViewDataColumns and DataTemplate (TextBox, ComboBox). I need 2 tab switches to select the control of the cell.
How can I change it to 1 tab?

5 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 14 Oct 2014, 12:35 PM
Hi Daniel,


Thank you for contacting us. 

You may set EditTriggers property of a column (or the entire RadGridView) to CellClick

If you placed these controls within CellTemplate, you could define your custom column.
Once the corresponding cells is being tabbed to, just focus the TextBox or the ComboBox elements. 
I'm attaching you small sample demo, which illustrates the second approach. 

Hope this helps. 

Regards,
Vanya Pavlova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Daniel
Top achievements
Rank 1
answered on 14 Oct 2014, 01:11 PM
Hi Vanya,
thanks for your reply, I can't find the example?
0
Vanya Pavlova
Telerik team
answered on 14 Oct 2014, 02:41 PM
Hi Daniel,


The attached .zip file, should be visible now. 

Please excuse us for any inconvenience caused. 


Regards,
Vanya Pavlova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Daniel
Top achievements
Rank 1
answered on 15 Oct 2014, 06:16 AM
Hello Vanya,
thanks for the expample, but it doesn't work for my implementation:
That's my current Implementation:

<telerik:GridViewDataColumn Header="Position" Width="*" >
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <Nominal:DoubleUpDown Value="{Binding Position, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                                                  ValidatesOnNotifyDataErrors=True, ValidatesOnDataErrors=True}"
                                                  Style="{StaticResource DoubleValidationErrorStyle}">
                                    <i:Interaction.Triggers>
                                        <prism:InteractionRequestTrigger SourceObject="{Binding  PositionSelectionRequest, Mode=OneWay}">
                                            <prism:PopupWindowAction IsModal="False" CenterOverAssociatedObject="True">
                                                <prism:PopupWindowAction.WindowContent>
                                                    <inf:ItemSelectionView />
                                                </prism:PopupWindowAction.WindowContent>
                                            </prism:PopupWindowAction>
                                        </prism:InteractionRequestTrigger>
                                        <i:EventTrigger EventName="LostFocus">
                                            <i:InvokeCommandAction Command="{Binding RaisePositionSelectionCommand}"  />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </Nominal:DoubleUpDown>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <Nominal:DoubleUpDown Value="{Binding Position, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                                                  ValidatesOnNotifyDataErrors=True, ValidatesOnDataErrors=True}"
                                                  Style="{StaticResource DoubleValidationErrorStyle}">
                                    <i:Interaction.Triggers>
                                        <prism:InteractionRequestTrigger SourceObject="{Binding  ItemPositionSelectionRequest, Mode=OneWay}">
                                            <prism:PopupWindowAction IsModal="False" CenterOverAssociatedObject="True">
                                                <prism:PopupWindowAction.WindowContent>
                                                    <inf:ItemSelectionView />
                                                </prism:PopupWindowAction.WindowContent>
                                            </prism:PopupWindowAction>
                                        </prism:InteractionRequestTrigger>
                                        <i:EventTrigger EventName="LostFocus">
                                            <i:InvokeCommandAction Command="{Binding RaisePositionSelectionCommand}"  />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </Nominal:DoubleUpDown>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>

If i click into the cell the BeginningEdit event shall be triggered. If I tab to another cell, the control of cell shall be focused and the BeginningEdit event shall be triggered. 
0
Boris
Telerik team
answered on 15 Oct 2014, 02:03 PM
Hello Daniel,

In order to trigger the BeginningEdit event of RadGridView, you will need to enter edit mode state of the cell. That will not happen if you have an editor control in your CellTemplate, because it will get the focus instead of the editor defined in your CellEditTemplate. There are several ways in which you can deal with this issue:
1) Use the default CellTemplate, which is a TextBlock bound to the DataMemberBinding property of the current column.
2) Still use your DoubleUpDown control as a CellTemplate. However, you will need to make sure you will enter into edit mode state of the editor defined in CellEditTemplate and not the one in CellTemplate. Thus ensuring that the BeginningEdit event of RadGridView will be triggered. In order to do that you will need to disable the DoubleUpDown in the CellTemplate, by setting it's IsEnabled property to "False".
3) Another possible way to go about this issue is not to rely on the BeginningEdit event of RadGridView and use only a CellTemplate. Then you can add a handler for a specific to your needs event of the DoubleUpDown and implement your logic there. In order to make sure that a client will not enter in the edit mode state of the cell, you can set the IsReadOnly property of that column to "True".

I hope this helps.

Regards,
Boris Penev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Daniel
Top achievements
Rank 1
Boris
Telerik team
Share this question
or