InfinitePii
InfinitePii

Reputation: 33

WPF - ListBox with a ScrollBar that can't be clicked

This can sound strange, but is it possible to achieve such a thing? What I want is a normal Scroll Bar with a standard behaviour, except it can't be clicked, grabbed and moved up and down by a user - it should just be there, moving when the content is being scrolled.

Upvotes: 0

Views: 78

Answers (1)

eran otzap
eran otzap

Reputation: 12533

   <Grid>

      <Grid.Resources>
        <Style TargetType="ScrollBar">
             <Setter Property="IsHitTestVisible" Value="False" />
        </Style>
      </Grid.Resources>

     <ListBox Height="150">
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>
         <ListBoxItem>1</ListBoxItem>       
     </ListBox>

  </Grid>

Upvotes: 3

Related Questions