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

InputBindings not working

4 Answers 940 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 18 Jul 2013, 09:50 AM
Not sure if doing something wrong but mouse double click input bindings does not appear to work on the grid view (if I hook up an event it works, but don't really want to have event code behind in view:)  is this suposed to function? NB using .NET 4
I should mention that this works on the header cell to the top left of the control but not the actual data cells themselves - and when the input bindings are against the  <telerik:GridViewDataColumn.InputBindings> it does not work either
<telerik:RadGridView x:Name="ResultsView" IsReadOnly="True" ItemsSource="{Binding Path=Dossiers,Mode=OneWay}" AutoGenerateColumns="False" SelectedItem="{Binding CurrentDossier, Mode=OneWayToSource}"  Grid.Column="0" Grid.Row="1">
              <telerik:RadGridView.InputBindings>
                  <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding SearchCommand}" CommandParameter="{Binding ElementName=ResultsView,Path=SelectedCells,Mode=OneWay}"></MouseBinding>
              </telerik:RadGridView.InputBindiIngs>

4 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 23 Jul 2013, 11:24 AM
Hello James,

Actually, this would be an expected behaviour, since a double-click on the row does trigger the RowActivated event and BeginningEdit event.

However, if you want to have your code-behind clean, the way to go is with an Attached behavior. Here you can find information about it. You will write the attached behavior only once. This attached behavior will attach to the event and will set the InputBinding. Then you can enable this attached behavior on a RadGridView. Here is a very nice article about event handling with attached behaviors. You have the code in one place only. All you will need to do is something like this:

<RadGridView EnableMyAttachedBehavior="True"/> and then let the attached behavior kick in and do its job.

Another option would be to use interaction triggers and MVVM Light as described in this help article

I hope this information helps.


Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Giulio
Top achievements
Rank 1
answered on 20 Jul 2016, 06:09 PM
The fact that a double-click on the row does trigger the RowActivated event and BeginningEdit event is not a reason for InputBindings not to work. I remain convinced that this is an annoying bug.
0
Giulio
Top achievements
Rank 1
answered on 20 Jul 2016, 06:17 PM
Also, redirecting developers to a typical Microsoft article is not going to make them happy.
0
Ivan Ivanov
Telerik team
answered on 25 Jul 2016, 03:45 PM
Hi Giulio,

InputBinding are design to work only with unhandled events. RadGridView follows the established paradigm of using routed event, to handle events that cause some functional effect in the control. For instance, when a row is (double)clicked it gets selected, activated or/and an EditTrigger is triggered. Thus the respective events are handled by the row. Similar behavior with the WPF TextBox is discussed in this thread.

Regards,
Ivan Ivanov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Giulio
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or