你好,
似乎有一个比较简单的XAML方式能实现这样的效果,你试试:
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type ComboBoxItem}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="FontStyle" Value="Italic" />
</Trigger>
</Style.Triggers>
</Style>
<src:VacationSpots x:Key="myVacations"></src:VacationSpots>
</Grid.Resources>
<Button Content="Button" HorizontalAlignment="Left" Margin="272,10,0,0" VerticalAlignment="Top" Width="20" Click="Button_Click"/>
<ComboBox Name="Combobox1" ItemsSource="{StaticResource myVacations}" HorizontalAlignment="Left" Margin="30,50,0,0" VerticalAlignment="Top" Width="235" Height="45" MouseMove="Combobox1_MouseMove">
</ComboBox>
</Grid>
我把关键代码给黑体了。
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.