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

Handler type not valid error with GridViewRow Selected event

4 Answers 359 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 09 Aug 2013, 11:23 PM
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?





4 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 13 Aug 2013, 02:41 AM
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
0
Yoan
Telerik team
answered on 13 Aug 2013, 11:03 AM
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 >>
0
Sebastien
Top achievements
Rank 1
answered on 30 Jul 2015, 03:29 PM
The link to ticket is now invalid! I would like to have the answer?
0
Dimitrina
Telerik team
answered on 31 Jul 2015, 08:09 AM
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
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Yoan
Telerik team
Sebastien
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or