我有一个可沿水平和垂直方向拉伸的堆栈面板。堆栈面板内部是一个文本块。当我在堆栈面板上放置鼠标滚轮的交互触发器时,仅当我在文本块上方时才会触发。我认为拉伸面板以填充其父面板可以解决此问题,但事实并非如此。我知道面板是拉伸的,因为背景色占据了整个区域。有什么办法可以在整个堆栈面板中发生触发?这是代码:
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseWheel">
<i:InvokeCommandAction Command="{Binding DataContext.PreviousWeekCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Style.Triggers>
<DataTrigger Binding="{Binding Month, Converter={StaticResource IsCurrentMonthConverter}}"
Value="false">
<Setter Property="Background" Value="#FFD3D3D3"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<TextBlock Text="{Binding Day}" HorizontalAlignment="Left"/>
</StackPanel>