On my wpf form i have image and toggle button controls. On image mouse over i want to raise event to the toggle button - this event will actully will simulate the mouser enter to the toggle button.
出于某种原因,一架飞机在车上坠毁 活动。
守则:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=".9*"/>
<RowDefinition Height=".1*"/>
</Grid.RowDefinitions>
<ToggleButton Name="toggleBtn" Grid.Row="0" Grid.RowSpan="2" Content="...test..." VerticalContentAlignment="Bottom" />
<Image Name="imgCtrl" Grid.Row="0" Source="someImg.jpg" Stretch="Fill" MouseEnter="imgMouseEnter_Event" />
</Grid>
扰乱活动守则
private void imgMouseEnter_Event( object sender, MouseEventArgs e )
{
toggleBtn.RaiseEvent( new RoutedEventArgs( ToggleButton.MouseEnterEvent ) );
}
Thanks for any help.