This is a migrated thread and some comments may be shown as answers.

Showing Vertical & Horizontal ScrollBar in a ListBox

3 Answers 361 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hela
Top achievements
Rank 1
Hela asked on 05 Feb 2009, 04:43 PM
Hi,
I've a Border that contains a StackPanel with a ListBox .But, I can't Show Vertical & Horizontal ScrollBar in a ListBox even if I wrote

ScrollViewer.HorizontalScrollBarVisibility

="Auto"

 

 

ScrollViewer.VerticalScrollBarVisibility="Auto"

 


Can someone please give me a solution for that?
thanks a lot,
Héla

3 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 06 Feb 2009, 09:10 AM

Hello Hela,

Remove the StackPanel and you will see the ScrollBars (if you have more items then available space).
The StackPanel is measuring with Infinity (depending on Orientation property) so ScrollViewer will think that he have enough space and will not show the ScrollBars.

Let me know if you need more help.

Kind regards,

Hristo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Hela
Top achievements
Rank 1
answered on 07 Feb 2009, 08:04 AM
Hi Hristo,
Thanks a lot for your answer.It's just what I needed!
Hope good work for you,
Héla
0
Hardik
Top achievements
Rank 1
answered on 22 Aug 2012, 05:35 AM
Hii,

I am facing a similar issue, but even after removing the Stack Panel, I am not able to view scrollviewer.

<UserControl.Resources>
    <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
        <telerik:RadWrapPanel Width="610" Height="300" />
    </ItemsPanelTemplate>
    <DataTemplate x:Key="DataTemplate1">
        <Border BorderBrush="#cecfce" BorderThickness="1">
            <StackPanel Orientation="Horizontal" Width="200" Height="24" >
                <TextBlock Text="{Binding Path=Name}" Margin="5,0,0,0" VerticalAlignment="Center" ></TextBlock>
            </StackPanel>                          
        </Border>
    </DataTemplate>
</UserControl.Resources>
 
<Grid x:Name="LayoutRoot" Background="White" Margin="50,50,50,0">
    <telerik:ListBox ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" x:Name="list" MaxHeight="300" Grid.Row="0" Grid.Column="0"  VerticalAlignment="Top" ItemsPanel="{StaticResource ItemsPanelTemplate1}" ItemTemplate="{StaticResource DataTemplate1}">
    </telerik:ListBox>         
</Grid>
Tags
General Discussions
Asked by
Hela
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Hela
Top achievements
Rank 1
Hardik
Top achievements
Rank 1
Share this question
or