I will show you a demo to invoke the PreviewMouseWheel in the UserControl:
The code for UserControl1.xaml:
<UserControl x:Class="InvokePreviewMouseWheel.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InvokePreviewMouseWheel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Name="myUserControl"
PreviewMouseWheel="myPreviewMouseWheel"
>
<Grid>
<Border CornerRadius="15" Margin="5,5,5,5" BorderThickness="2" Background="Azure" >
<TabControl Name="myTabControl" PreviewMouseWheel="myPreviewMouseWheel">
<TabItem Name="myTabItem" PreviewMouseWheel="myPreviewMouseWheel">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Ellipse Width="10" Height="10" Fill="DarkGray"/>
<TextBlock>Tab 1</TextBlock>
</StackPanel>
</TabItem.Header>
<StackPanel Name="myStackPanel" PreviewMouseWheel="myPreviewMouseWheel">
<ScrollViewer Name="myScrollViewer" HorizontalScrollBarVisibility="Auto" Height="200" PreviewMouseWheel="myPreviewMouseWheel">
<StackPanel>
<ListBox x:Name="listBox" Height="250" Width="300" FontFamily="15" PreviewMouseWheel="myPreviewMouseWheel"></ListBox>
</StackPanel>
</ScrollViewer>
</StackPanel>
</TabItem>
<TabItem Header="Tab 2">
<TextBlock Text="{Binding ElementName=textBox1, Path=Text}"/>
</TabItem>
</TabControl>
</Border>
</Grid>
</UserControl>
The code for UserControl1.xaml.cs:
private void myPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
string message = "PreviewMouseWheelEvent_Element:" + (sender as FrameworkElement).Name.ToString();
this.listBox.Items.Add(message);
}
Then input the UserControl1 in the MainWindow.xaml : <local:UserControl1></local:UserControl1>
Build and run the project and you will get the below result: