5

I am trying to disable highlight when an item in ListBox is selected. That means, the item in the ListBox still fires the select event but it doesn't change the colour

skaffman
  • 398,947
  • 96
  • 818
  • 769
vodkhang
  • 18,639
  • 11
  • 76
  • 110

1 Answers1

6

kP outlined the procedure to apply highlighting here.

Windows Phone 7: Highlight Selected Listbox item

The procedure is pretty much the same to remove the highlighting.. you just delete the storyboard in the Selected Visual State from the copy you made of the template.

So..

  1. Open the project in blend.
  2. Target the listbox
  3. Right click, Edit Additional Templates, Edit Generated Item Container, Edit a Copy
  4. Go to the xaml and change
<VisualState x:Name="Selected">
  <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
    </ObjectAnimationUsingKeyFrames>
  </Storyboard>
</VisualState>

to

<VisualState x:Name="Selected"/>
Community
  • 1
  • 1
Mick N
  • 14,892
  • 2
  • 35
  • 41
  • I can do it now but I still have a little issue, do you know about custom control. I cannot set target type to my custom control. I created a subclass of ListBox and add the style into my sub class. But the style does not get recognized – vodkhang Dec 28 '10 at 06:30