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

Detect if fluent scrollbar is normal or compact

5 Answers 259 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bracco
Top achievements
Rank 1
Veteran
Bracco asked on 17 Jul 2020, 12:41 PM

Hi there,

I'd like to change the padding of my listbox on the right side depending on the 3 states of the vertical scrollbar (i.e collapsed, compact, normal).

Doing the following tweak allows me to change the padding when the vertical scrollbar is visible or not but I can't find how to change the padding based on the compact/normal mode state of the scrollbar.

<telerik:RadListBox.Style>
    <Style TargetType="{x:Type telerik:RadListBox}">
        <Setter Property="Padding" Value="8,4" />
        <Style.Triggers>
            <Trigger Property="ScrollViewer.ComputedVerticalScrollBarVisibility" Value="Visible">
                <Setter Property="Padding" Value="8,4,24,4" />
            </Trigger>
        </Style.Triggers>
    </Style>
</telerik:RadListBox.Style>

5 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 22 Jul 2020, 08:37 AM

Hi Hugo,

Determining the current state of the scrollbar will not be straightforward if the Auto ScrollViewerScrollBarsMode is used.

If you're using any of the other two modes, however, I can recommend creating a custom converter for the binding and checking the value of the static FluentPalette.Palette.ScrollBarsMode property to determine what padding to return.

Please let me know if such an approach would work for you.

Regards,
Dilyan Traykov
Progress Telerik

0
Bracco
Top achievements
Rank 1
Veteran
answered on 22 Jul 2020, 12:56 PM

Hi Dilyan,

 

Sadly, as you guessed, I am using the auto mode. Is it possible to prevent the use of this only for a specific control?

Regards,
Hugo

0
Dilyan Traykov
Telerik team
answered on 23 Jul 2020, 07:19 AM

Hi Hugo,

I'm sorry to hear that my suggestion will not work for you.

Luckily, there is a way to apply this setting per control and it is by using the ThemeHelper class from the Telerik.Windows.Controls.Theming.Helpers namespace as follows:

xmlns:helpers="clr-namespace:Telerik.Windows.Controls.Theming.Helpers;assembly=Telerik.Windows.Controls"
            <telerik:RadListBox.Resources>
                <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollBarStyle}">
                    <Setter Property="helpers:ThemeHelper.ScrollBarsMode" Value="Compact"/>
                </Style>
            </telerik:RadListBox.Resources>
Please give this a try and let me know if it works for you.

Regards,
Dilyan Traykov
Progress Telerik

0
Bracco
Top achievements
Rank 1
Veteran
answered on 24 Jul 2020, 07:57 AM

It worked perfectly, thank you.

For future release of your product, it'd be nice to either provide a way to detect the current width or mode of the scrollbar and/or make sure that some controls (e.g. `RadListBox`) automatically add padding/margin to avoid ending up in situations where the scroll is over the controls.

Kind regards,
Hugo

0
Dilyan Traykov
Telerik team
answered on 24 Jul 2020, 11:18 AM

Hello Hugo,

Thank you for the feedback.

If you feel other users would also benefit from such a feature, please feel free to create a new feature request in our feedback portal and if it accumulates enough votes, we will consider its implementation in the future.

In the meantime, I'm happy to hear that my suggestion worked for you. If I can be of any further assistance, please let me know.

Regards,
Dilyan Traykov
Progress Telerik

Tags
General Discussions
Asked by
Bracco
Top achievements
Rank 1
Veteran
Answers by
Dilyan Traykov
Telerik team
Bracco
Top achievements
Rank 1
Veteran
Share this question
or