About the Style of the ScrollViewer ...

Jan 5, 2013 at 5:00 AM

After I add this library, I found that the App.xaml has been modified:

 

    <Style TargetType="ScrollViewer">
      <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
      <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
      <Setter Property="Background" Value="Transparent" />
      <Setter Property="Padding" Value="0" />
      <Setter Property="BorderThickness" Value="0" />
      <Setter Property="BorderBrush" Value="Transparent" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ScrollViewer">
            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="ScrollStates">
                  <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="00:00:00.5" />
                  </VisualStateGroup.Transitions>
                  <VisualState x:Name="Scrolling">
                    <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                      <DoubleAnimation Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="NotScrolling"></VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="VerticalCompression">
                  <VisualState x:Name="NoVerticalCompression" />
                  <VisualState x:Name="CompressionTop" />
                  <VisualState x:Name="CompressionBottom" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="HorizontalCompression">
                  <VisualState x:Name="NoHorizontalCompression" />
                  <VisualState x:Name="CompressionLeft" />
                  <VisualState x:Name="CompressionRight" />
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Grid Margin="{TemplateBinding Padding}">
                <ScrollContentPresenter x:Name="ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
                <ScrollBar x:Name="VerticalScrollBar" IsHitTestVisible="False" Height="Auto" Width="5" HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{TemplateBinding VerticalOffset}" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" />
                <ScrollBar x:Name="HorizontalScrollBar" IsHitTestVisible="False" Width="Auto" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{TemplateBinding HorizontalOffset}" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" />
              </Grid>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>


Why do u set the value of the "HorizontalScrollBarVisibility" to "Auto"?

 This will make the listbox style became abnormal.

I think that it's better to set the value to "Disable".