Class BubbleScrollEvent
Behavior for giving the scroll event to the parent dependency object.
public class BubbleScrollEvent : Behavior<UIElement>, IAnimatable, IAttachedObject
- Inheritance
-
BehaviorBehavior<UIElement>BubbleScrollEvent
- Implements
-
IAttachedObject
- Inherited Members
-
Behavior<UIElement>.AssociatedObjectBehavior.CreateInstanceCore()Behavior.Detach()Behavior.AssociatedType
- Extension Methods
Examples
This example shows a DataGrid with a ListBox inside the row details. When the user scrolls and the mouse is over the ListBox, the scroll event is normally executed by the ListBox.
This means the user cannot scroll the DataGrid.
Using the BubbleScrollEvent, the scroll event is bubbled to the DataGrid and user scrolls the DataGrid, also when the mouse is over the ListBox.
<UserControl x:Class="Demo.Views.CollectionTesterView"
xmlns:u="http://lisrt.de/utility"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity">
<DataGrid ItemsSource="{Binding Items}" >
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding InnerItems}">
<i:Interaction.Behaviors>
<u:BubbleScrollEvent/>
</i:Interaction.Behaviors>
</ListBox>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</UserControl>
Remarks
'Bubbling' means giving something to the next object. Like bursting bubbles.
Methods
OnAttached()
Called after the behavior is attached to an AssociatedObject. Adds AssociatedObjectPreviewMouseWheel(object, MouseWheelEventArgs) to PreviewMouseWheel of System.Windows.Interactivity.Behavior<T>.AssociatedObject.
protected override void OnAttached()
OnDetaching()
Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred. Removes AssociatedObjectPreviewMouseWheel(object, MouseWheelEventArgs) to PreviewMouseWheel of System.Windows.Interactivity.Behavior<T>.AssociatedObject.
protected override void OnDetaching()