Handler type not valid error with GridViewRow Selected event

5 posts, 0 answers
  1. David
    David avatar
    46 posts
    Member since:
    Nov 2008

    Posted 09 Aug 2013 Link to this post

    I'm getting "Handler type not valid" when I set the Selected event in the RowStyle.
    My XAML is:
    <telerik:RadGridView.RowStyle>
      <Style TargetType="telerik:GridViewRow" >
         <EventSetter Event="Selected" Handler="pHandleItemSelected" />
      </Style>
    </telerik:RadGridView.RowStyle>
    And my event handler is:
    Private Sub pHandleItemSelected(sender As System.Object, e As RoutedEventArgs)
    End 

    The documentation says that this is the type of handler. So what is the problem?





  2. David
    David avatar
    46 posts
    Member since:
    Nov 2008

    Posted 12 Aug 2013 Link to this post

    I have figured out that the problem is the event is defined as RoutedEventHandler but is actually RadRoutedEventHandler.
    I have reported this under Ticket 725826
  3. UI for WPF is Visual Studio 2017 Ready
  4. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 13 Aug 2013 Link to this post

    Hi David,

    I have already answered your ticket containing the same question. 

    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 >>
  5. Sebastien
    Sebastien avatar
    3 posts
    Member since:
    Apr 2014

    Posted 30 Jul 2015 in reply to Yoan Link to this post

    The link to ticket is now invalid! I would like to have the answer?
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Jul 2015 Link to this post

    Hello,

    The answer in the support ticket was:

    Indeed, you are absolutely right. Unfortunately, this can not be changed without introducing breaking changes. What you can try is to attach to the event like so:

    public MainWindow()
    {
        InitializeComponent();
        AddHandler(GridViewRow.SelectedEvent, new RoutedEventHandler(row_Selected));
    }
     
    void row_Selected(object sender, RoutedEventArgs e)
    {
              
    }

    Copy Cod

    Then, the answer from the client was:
    I did have to change my handler to get the row from e.OriginalSource instead of sender. Also, the event still is not raised until the row is loaded so I still need to keep my SelectionChanged handler where I call ScrollIntoView. But at least this eliminates the RowLoaded event and I can now go back to "Option Strict On".

    I hope this helps.

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready