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

How to stop an event propagation to a parent control.

2 Answers 886 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Young-Lae Chung
Top achievements
Rank 1
Young-Lae Chung asked on 14 Dec 2010, 12:40 PM
Hi.

I used two RadExpanders  in application.
The one is nested in another one (parent / child relationship).

I want to use a expand (or collapsed) event handler seperately.
But when child expander's event is fired, the event is propagated to parent's event handler.

How can I stop it ?

Please, let me know that. 

Thanks. 



2 Answers, 1 is accepted

Sort by
0
Young-Lae Chung
Top achievements
Rank 1
answered on 15 Dec 2010, 06:06 AM
I solved above problem using Handled property of RadRoutedEventArgs.

In collapsed-event handler of child expander. 
private void SelectionExpander_Collapsed(object sender, RoutedEventArgs e)
{
   ((Telerik.Windows.RadRoutedEventArgs)(e)).Handled = true;
}

After do that, collapsed-event is not propagated to event handler of parent expander.

If you have other solutions, please let me know that.

Thanks.  



0
Accepted
Petar Mladenov
Telerik team
answered on 16 Dec 2010, 04:46 PM
Hi Young-Lae Chung,

Another workaround could be the following: in the PreviewCollapsed event of the parent Expander, you check whether the child Expander is collapsed. And if it is ==> set  e.handled = true again. In addition the two approaches seems to be similar, but they can behave in a different way if you have more child expanders or more parent expanders or both. Feel free to ask if you need further assistance.

Best wishes,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Expander
Asked by
Young-Lae Chung
Top achievements
Rank 1
Answers by
Young-Lae Chung
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or