日期:2014-05-17  浏览次数:21072 次

WPF给ListBox添加效果:鼠标滑过每项时背景色改变
类似VS2010中Toolbox的效果,鼠标滑过每一项的时候背景色都改变,给个思路或代码,刚学这个,什么都不会。
<ListBox Height="276" HorizontalAlignment="Left" Name="listBox1" VerticalAlignment="Top" Width="117">
            <ListBoxItem>
                <Expander Header="Area">
                    <StackPanel>
                        <StackPanel Orientation="Vertical">
                            <TextBlock>Ward</TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <TextBlock>Room</TextBlock>
                        </StackPanel>
                    </StackPanel>
                </Expander>
            </ListBoxItem>
            <ListBoxItem>
                <Expander Header="Terminal">
                    <StackPanel>
                        <StackPanel  Orientation="Horizontal">
                            <TextBlock>Button1</TextBlock>
                        </StackPanel>
                        <StackPanel  Orientation="Horizontal">
                            <TextBlock>Button2</TextBlock>
                        </StackPanel>
                        <StackPanel  Orientation="Horizontal">
          &nb