我有一个ListPanel,它包含一个包含图像和标签的StackPanel。WPF ListBox DataTemplate和Image问题
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Image Source="{Binding Image}" Cursor="Hand" Tag="{Binding Link}" MouseLeftButtonDown="Image_MouseLeftButtonDown" ToolTip="Click to see this product on adidas.com" VerticalAlignment="Top" HorizontalAlignment="Left" />
<Label Content="{Binding Name}" Cursor="Hand" Tag="{Binding Link}" MouseLeftButtonDown="Label_MouseLeftButtonDown" VerticalAlignment="Bottom" Foreground="White" Style="{StaticResource Gotham-Medium}" FontSize="8pt" HorizontalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
我想在当前蒙上的图像后面显示第三个图像(glow.png)。我似乎无法添加第二个图像到堆叠面板,并将其设置为隐藏状态。我甚至还没有解决鼠标悬停的部分。
是否在堆叠面板中添加另一个图像,然后将其设置为可见性,以便在mouseenter上看到正确的方法,然后在mouseleave上交换回来?
谢谢。
使用的位图的影响,谢谢,好主意。 – 2008-12-23 05:11:16