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

FluentPalette.Palette.ScrollBarsMode

2 Answers 127 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Richard asked on 22 Jun 2020, 10:25 PM

Is it possible to set the Scrollbars mode on a single control (not the whole app)?

FluentPalette.Palette.ScrollBarsMode = ScrollViewerScrollBarsMode.Compact;

Thanks,

Richard

2 Answers, 1 is accepted

Sort by
0
Accepted
Vicky
Telerik team
answered on 23 Jun 2020, 03:50 PM

Hi Richard,

Yes, it is possible. A sample code snippet follows. It has a UserControl, containing a simple RadListBox with 10 items and a ScrollViewer with 10 Buttons as its content:

<UserControl x:Class="ScrollViewerWpf.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:helpers="clr-namespace:Telerik.Windows.Controls.Theming.Helpers;assembly=Telerik.Windows.Controls">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="200" />
            <RowDefinition Height="200" />
        </Grid.RowDefinitions>
        <telerik:RadListBox Grid.Row="0" Margin="10">
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
            <telerik:RadListBoxItem Content="Item"/>
        </telerik:RadListBox>
        <ScrollViewer MaxHeight="150" Grid.Row="1">
            <ScrollViewer.Resources>
                <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollBarStyle}">
                    <Setter Property="helpers:ThemeHelper.ScrollBarsMode" Value="Compact"/>
                </Style>
            </ScrollViewer.Resources>
            <StackPanel>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
                <Button Content="Content"/>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>

I marked the most important part which does the magic. :)
Please, try it out in your application and let me know if you're satisfied with the end result.

Regards,
Vicky
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 23 Jun 2020, 04:03 PM
That's worked perfectly, thank you Vicky!
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Vicky
Telerik team
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or