Raising event - type of SelectionChangedEventHandler

2 posts, 0 answers
  1. Maulik Patel
    Maulik Patel avatar
    36 posts
    Member since:
    Mar 2010

    Posted 03 Sep 2010 Link to this post


    I want to raise a new event called SelectionChanged from my own user control which uses RadGridVie. This new event will be raise when RadGridView control raises the SelectionChanged event.

     The problem is SelectionChangedEventHandler expects eventargs type of "SelectionChangedEventArgs" but SelectionChanged event of RadGridView uses "SelectionChangeEventArgs".

    How do I handle this type of casting? Do I need to create a new instance of SelectionChangedEventArgs and pass to new event after assigning new values ? Or there is any other work around?

    Also, what is the actual different between these two event arguments?



    public event Telerik.Windows.Controls.SelectionChangedEventHandler SelectionChanged;
    private void Grid_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) 
        //this.RaiseSelectionChangedEvent(sender, e); 
    protected virtual void RaiseSelectionChangedEvent(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e) 
        if (SelectionChanged != null) 
            SelectionChanged(sender, e);


  2. Vlad
    Vlad avatar
    11100 posts

    Posted 03 Sep 2010 Link to this post


     You can construct the new args from the grid arguments:

     private void RadGridView_SelectionChanged(object sender, SelectionChangeEventArgs e)
           var newArgs = new System.Windows.Controls.SelectionChangedEventArgs(e.RemovedItems, e.AddedItems);

    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top