Windows phone 7 如何避免单击列表框时列表框项目的颜色变化?
我对列表框中的项目有一个问题。 当我向列表框中添加文本,然后单击它时,它会得到强调色Windows phone 7 如何避免单击列表框时列表框项目的颜色变化?,windows-phone-7,Windows Phone 7,我对列表框中的项目有一个问题。 当我向列表框中添加文本,然后单击它时,它会得到强调色 是否可以避免这种影响,只保留文本原来的颜色?您可以使用混合来编辑listboxitem的ControlTemplate 或者,您可以使用以下代码更改颜色: <Style x:Key="ListBoxItemStyleBackground" TargetType="ListBoxItem"> <Setter Property="Background" Value="Tra
是否可以避免这种影响,只保留文本原来的颜色?您可以使用混合来编辑listboxitem的ControlTemplate 或者,您可以使用以下代码更改颜色:
<Style x:Key="ListBoxItemStyleBackground" TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected"/>
<VisualState x:Name="Selected">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
***<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}" />*** <!--edit here-->
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
******