How to get mobile scrollbar width?

How to get or compute actual width of ListBox without Vertical Scrollbar if visible

  • I wonder how to get or compute actual width of ListBox without Vertical Scrollbar if visible. What I want to do is changing width of each items inside ListBox without being covered by Vertical Scrollbar. Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}} At least, above binding tell me the actual width of ListBox, but this one does not handle width of vertical scrollbar. Is there any good way to solve this?

  • Answer:

    Try binding to the ViewportWidth property of the containing ScrollViewer instead. Like this: Width="{Binding Path=ViewportWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ScrollViewer}}"

Aki24x at Stack Overflow Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.