<Style TargetType="ScrollViewer">
<Setter Property="telerik:StyleManager.Theme" Value="Windows7" />
</Style>
<Style x:Key="ListViewNoHighlightSelection" TargetType="ListView">
<Style.Resources>
<!-- Background of selected item when focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<!-- Background of selected item when not focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
</Style.Resources>
</Style>
This is how I use this style:
<ListView x:Name="advertFormatSelector" Grid.Row="0" Grid.Column="0"
Grid.ColumnSpan="7"
Margin="2,2"
BorderThickness="0"
ItemsSource="{Binding BasketItemTemplates}"
SelectedItem="{Binding SelectedBasketItemTemplate, Mode=TwoWay}"
MaxHeight="100"
>
<ListView.Style>
<Style BasedOn="{StaticResource ListViewNoHighlightSelection}"
TargetType="{x:Type ListView}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Dimensions}"
Value="{x:Null}">
<Setter Property="BorderBrush"
Value="{StaticResource ErrorBrush}" />
<Setter Property="BorderThickness"
Value="2" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListView.Style>
<ListBox.ItemContainerStyle> .. </ListBoxItemContainerStyle>
<ListView.ItemTemplate>... </ListView.ItemTemplate>
</ListView>
My problem is that the scrollviewer is displayed but it is non-functional (grayed out) since the listview has all the space it needs. I guess showing non-functional scrollbars are part of the theme, but I want no scrollbar when no scrolling is nessesary. I do not want that scrollviewer to be displayed. Adding:
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
(or even setting the value to Disabled)
acheives nothing - I've tried to apply these lines to ListViewNoHighlightSelection, to my listview and to its style.
Why do the GUI behave like that and how do I make the scrollbar dissappear ?