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
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
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
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>
Regards,
Dilyan Traykov
Progress Telerik
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
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