ScrollViewer in a ListBox not working. WPF.

Posted by guest on Stack Overflow See other posts from Stack Overflow or by guest
Published on 2010-05-11T14:19:56Z Indexed on 2010/05/11 14:24 UTC
Read the original article Hit count: 197

Filed under:
|
|

Hi, I have the following defined in my control:

    <local:TestListBox.ItemTemplate>
     <DataTemplate>
      <Border  x:Name="eventBorder" Width="{Binding ElementName=eventsLbx, Path=ActualWidth,BorderBrush="{Binding Color}" BorderThickness="1" CornerRadius="4">
       <Border.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
         <GradientStop x:Name="StartGradient" Color="#FFFFFFFF" Offset="0"/>
         <GradientStop x:Name="EndGradient" Color="{Binding Color}" Offset="1"/>
        </LinearGradientBrush>
       </Border.Background>
       <Border.ToolTip>
        <ToolTip Content="{Binding Text}"/>
       </Border.ToolTip>
       <TextBlock TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" FontSize="12" Text="{Binding Text}" />
      </Border> 

                                    <DataTemplate.Triggers>

                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter TargetName="eventBorder" Property="Background" Value="#FFE4EBF5"/>
                                        </Trigger>

                                    </DataTemplate.Triggers> -->

                                </DataTemplate>
    </local:TestListBox.ItemTemplate>
   </local:TestListBox>   
                           </ScrollViewer.Content>
                        </ScrollViewer>
  </Grid>                            
  <ControlTemplate.Triggers>
   <Trigger SourceName="eventsLbx" Property="HasItems" Value="False">
    <Setter TargetName="eventsLbx" Property="Visibility" Value="Hidden"/>
   </Trigger>
  </ControlTemplate.Triggers>
 </ControlTemplate>
</Setter.Value>

Now if there are more items than are visible, then the scrollviewer appears properly but the user CANNOT drag the scrollviewer middle button for scrolling.

The user can click on the arrows at the end of the scrollviewer to scroll but he cannot click the bar that appears on the scrollbar and drag it to actually scroll the contents.

I cannot figure out why this is happening...

© Stack Overflow or respective owner

Related posts about scrollviewer

Related posts about wpf