I am using Syncfusion's TreeViewAdv contro开发者_运维百科l. I attach a KeypUp event handler to it and it worked as expected. The event is fired whenever I released a key. However, once I wrap it in a ScrollViewer, the event is not fired. I have to move the event handler up to the ScrollViewer itself to catch the event. I aslo checked the PreviewKeyUp event, at the ScrollViewer it is fired and the Handled is false. But the PreviewKeyUp for TreeViewAdv is not fired at all.
I try to replace the ScrollViewer with a StackPanel and everything is fine. So it seems that the ScrollViewer stops event propagation to its content. How can I get the event handled within the ScrollViewer?
I could see that this is happening only when you select item through mouse and then trying to catch KeyUp and KeyDown events. These events are firing properly when you navigate items through keyboard only such as using Tab Key.
This is known issue in TreeViewAdv control and Syncfusion fixed this. They promised like fix will be included in their forth coming release Vol1 2010 which is scheduled on end of Jan 2009.
As a workaround, you can use this code snippet to receive the event notification.
<Syncfusion:TreeViewAdv.Resources>
<Style TargetType="{x:Type syncfusion:TreeViewItemAdv}"> <EventSetter Event="MouseLeftButtonUp" Handler="TreeViewItemAdv1_MouseLeftButtonUp"/> </Style> </Syncfusion:TreeViewAdv.Resources>
Event handler in C#
private void TreeViewItemAdv1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { TreeViewItemAdv item= (sender as TreeViewItemAdv); If(item != null) { item.Focus(); } }
Thanks,
Madhan
精彩评论