1
当鼠标悬停时,我需要为列表项设置更改背景颜色。这里是我的代码:更改ListBoxItem背景当鼠标在列表框项上结束时的颜色
<DataTemplate x:Key="ListBoxSubCategoryListTemplate" DataType="{x:Type ListBoxItem}">
<StackPanel>
<Button x:Name="btnSubCategoryList" Template="{StaticResource subCategoryListItems}"
Content="{Binding Path=sub_category_name}"
Background="Transparent"
Height="25"/>
</StackPanel>
</DataTemplate>
<ControlTemplate x:Key="subCategoryListItems" TargetType="{x:Type Button}">
<StackPanel FlowDirection="LeftToRight" Orientation="Horizontal" >
<TextBlock Width="150"
Height="{TemplateBinding Button.Height}"
x:Name="textBlockSubCategoryName"
Background="{TemplateBinding Button.Background}"
Text="{TemplateBinding Button.Content}"
FontWeight="Bold" />
<Image x:Name="img" Width="15" Height="15" Source="/ExpressFurnitureSystem;component/Images/edit.png" ToolTip="Click to edit"></Image>
</StackPanel>
</ControlTemplate>
请帮忙...怎么样?
感谢您的帮助,戴夫。 – usergaro 2012-01-02 03:36:29
非常欢迎! – 2012-01-02 03:41:39