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

Custom routed events

3 Answers 98 Views
Window
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 13 Nov 2008, 06:52 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 14 Nov 2008, 09:03 AM
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.
0
hwsoderlund
Top achievements
Rank 1
answered on 14 Nov 2008, 09:31 AM
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
0
Hristo
Telerik team
answered on 14 Nov 2008, 01:54 PM
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.
Tags
Window
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Hristo
Telerik team
hwsoderlund
Top achievements
Rank 1
Share this question
or