I have UserControlone that basically wraps ListBoxas follows:
<ListBox x:Name="lb" ItemsSource="{Binding ElementName=UC,Path=Pages}"
Background="{Binding ElementName=UC,Path=Background}"
BorderBrush="Transparent"
ScrollViewer.CanContentScroll="False"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ElementName=UC,Path=ActualWidth}">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="20"/>
<ColumnDefinition/>
<ColumnDefinition MinWidth="20"/>
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="1" Content="{Binding}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I need to set FocusVisualStyleto {x:Null}to hide this functionality, but no matter where I use it, I still get the default highlight blue. I tried to install it in ListBox, StackPanel and Grid, but to no avail.
Any help would be great. thanks.
source
share