FluentPalette.Palette.ScrollBarsMode

3 posts, 1 answers
  1. Richard
    Richard avatar
    122 posts
    Member since:
    Feb 2009

    Posted 22 Jun 2020 Link to this post

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

    FluentPalette.Palette.ScrollBarsMode = ScrollViewerScrollBarsMode.Compact;

    Thanks,

    Richard

  2. Answer
    Vicky
    Admin
    Vicky avatar
    58 posts

    Posted 23 Jun 2020 Link to this post

    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.
  3. Richard
    Richard avatar
    122 posts
    Member since:
    Feb 2009

    Posted 23 Jun 2020 in reply to Vicky Link to this post

    That's worked perfectly, thank you Vicky!
Back to Top