Custom routed events

4 posts, 1 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 13 Nov 2008 Link to this post

    I'm trying to use custom routed events, and they seem to work fine until I put the control that raises the event in a RadWindow. I've uploaded a sample project. Is there a way to make routed events work across windows?

    http://cid-cc43a90a79374ebd.skydrive.live.com/self.aspx/Public/SilverlightApplication1.zip
  2. Answer
    Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 14 Nov 2008 Link to this post

    Hi Henrik,

    This is the expected behavior. You can easily override it by setting LogicalParent to RadWindow.
    Put this in Page_Content constructor (after InitializeComponent method):

    Telerik.Windows.RoutedEvent.SetLogicalParent(window, this); 

    If you need more help, I'll be glad to help.


    All the best,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 14 Nov 2008 Link to this post

    Ah, I see. Thanks, it works fine now. Just out of curiosity: Is this related to the fact that the window is based on a Popup control? /Henrik
  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 14 Nov 2008 Link to this post

    Hello Henrik,

    Yes routed events traverse the logical tree and the popup control that holds RadWindow is not in that tree. So setting logical parent changes the tree on which the event will route. Note that if you set some RadWindow with RadCalendar as child and set logical parent on RadWindow to be the same RadCalendar you will cause stackoverflow exception.

    If you need more information, do not hesitate to contact us.

    Regards,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top