0

嗨,我想要选定的列表框项目突出显示边框颜色。我使用下面给出的代码。请帮助我。

<ListBox x:Name="NotchsList11" Width="Auto" Grid.RowSpan="5" Margin="0,59,0,0">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel   Grid.ColumnSpan="3" x:Name="ControlsPanel"
                        Height="234"
                        VerticalAlignment="Top">
                    <StackPanel  Orientation="Horizontal" VerticalAlignment="Bottom" >
                        <TextBlock Grid.Row="1"  FontFamily="Calibri" FontSize="34" FontWeight="Bold"  FontStyle="Normal" Padding="10,0,0,0"
                                Text="{Binding name}" VerticalAlignment="Bottom"
                                   />
                    </StackPanel>
                    <ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <StackPanel Width="Auto">
                            <StackPanel VerticalAlignment="Top" Width="Auto">
                                <ListBox  ItemsSource="{Binding Articles}"   Margin="5,5,5,0" Width="Auto" ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="NotchsList11_SelectionChanged">
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal"  VerticalAlignment="Top">
                                            </StackPanel>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border BorderBrush="#302c2d" Background="#302c2d" BorderThickness="5,5,5,0"   Name="image"  Margin="3,0,3,0">
                                                <Image Source="{Binding Image}"  Width="141" Height="120" Name="value"  Stretch="Fill" VerticalAlignment="Top"></Image>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Top"  Width="Auto">
                                <ListBox  x:Name="NotchsList11"  ItemsSource="{Binding Articles}"  Margin="5,0,5,0"   ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="NotchsList11_SelectionChanged">
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal">
                                            </StackPanel>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                    <ListBox.ItemTemplate>
                                        <DataTemplate >
                                            <Border BorderBrush="#302c2d" Background="#302c2d"  BorderThickness="5,5,5,0"  Margin="3,0,3,0">
                                                <TextBlock Text="{Binding Titles}"   Width="141" Height="85" Padding="3,0,0,30"  TextWrapping="Wrap"></TextBlock>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>
                        </StackPanel>
                    </ScrollViewer>
                </StackPanel>
                </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

这是使用代码,我不知道如何设置选定项目的边框。所以请帮助我如何解决这个问题。Avance 谢谢

我需要如下图所示的输出,所选项目边框为红色。

在此处输入图像描述

4

1 回答 1

0

根据您的要求修改: customize-the-wp7-listbox-selected-item-visual-states

于 2013-05-09T07:35:17.193 回答