InputBindings not working

5 posts, 0 answers
  1. James
    James avatar
    2 posts
    Member since:
    Sep 2012

    Posted 18 Jul 2013 Link to this post

    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">
                      <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding SearchCommand}" CommandParameter="{Binding ElementName=ResultsView,Path=SelectedCells,Mode=OneWay}"></MouseBinding>
  2. Yoan
    Yoan avatar
    1051 posts

    Posted 23 Jul 2013 Link to this post

    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.

    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 >>
  3. DevCraft banner
  4. Giulio
    Giulio avatar
    2 posts
    Member since:
    Jul 2016

    Posted 20 Jul Link to this post

    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.
  5. Giulio
    Giulio avatar
    2 posts
    Member since:
    Jul 2016

    Posted 20 Jul Link to this post

    Also, redirecting developers to a typical Microsoft article is not going to make them happy.
  6. Ivan Ivanov
    Ivan Ivanov avatar
    1116 posts

    Posted 25 Jul Link to this post

    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.

    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.
Back to Top
DevCraft banner