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

RadGridview scroll problem

1 Answer 125 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
MK asked on 02 Aug 2010, 11:59 AM
Hi All,

Please can you tell me that how can i disable horizontal Scroll Bar ? 
If i set ScrollViewer.HorizontalScrollBarVisibility="Disable" then Scroll become hide but i want that it visible for user but not disable mode. How can i do it?


1 Answer, 1 is accepted

Sort by
Vanya Pavlova
Telerik team
answered on 02 Aug 2010, 04:42 PM
Hi Mahesh,

You should edit the control template of the GridViewScrollViewer and set the IsEnabled property of HorizontalScrollBar to false:
    <telerik:Office_BlackTheme x:Key="Theme"/>
    <RadialGradientBrush x:Key="GridView_ScrollViewerIntersectionRectangleBackground" Center="0 0" GradientOrigin="0 0" RadiusY="1" RadiusX="1">
        <GradientStop Color="#FF848484" Offset="0.066"/>
        <GradientStop Color="#FFBFBFBF" Offset="0.066"/>
        <GradientStop Color="#FFF0F0F0" Offset="0.29"/>
    <ControlTemplate x:Key="GridViewScrollViewerTemplate" TargetType="telerik:GridViewScrollViewer">
        <Grid x:Name="PART_RootPanel" Background="{TemplateBinding Background}">
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            <telerik:ScrollContentPresenter CanContentScroll="{TemplateBinding CanContentScroll}" Grid.Row="2"/>
            <ScrollBar x:Name="PART_VerticalScrollBar" BorderThickness="1,0,0,0" Grid.Column="1" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0.0" Orientation="Vertical" Grid.Row="0" Grid.RowSpan="4" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
            <ScrollBar x:Name="PART_HorizontalScrollBar" BorderThickness="0,1,0,0" Grid.Column="0" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0.0" Orientation="Horizontal" Grid.Row="4" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" IsEnabled="False"/>
            <Rectangle Grid.Column="1" Fill="{StaticResource GridView_ScrollViewerIntersectionRectangleBackground}" Grid.Row="4"/>
    <Style TargetType="telerik:GridViewScrollViewer">
        <Setter Property="Template" Value="{StaticResource GridViewScrollViewerTemplate}"/>

 Another approach is to do this using this sample:
var horizontalScrollbar = radGridView1.ChildrenOfType<ScrollBar>().Where(p => p.Orientation == Orientation.Horizontal).First();
           horizontalScrollbar.IsEnabled = false;

Best wishes,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question