views:

166

answers:

1

Hello.

In XAML I have a ScrollView and a ListView inside.

<ScrollViewer Margin="0, 0, 0, 2" HorizontalScrollBarVisibility="Visible">
      <ListView  BorderBrush="Red" BorderThickness="3" Name="listAnswers">

...
/>

So, when I remove the HorizontalScrollBarVisibility tag, my border is unmovable while scrolling, but if I set HorizontalScrollBarVisibility to "Auto" or "Visible" vertical Red border moves out and disappears.

How to enable scrollbar and set its border unmovable?

Pictures:

alt text

alt text

+1  A: 

You can use padding instead of border:

<ScrollViewer Margin="0, 0, 0, 2" HorizontalScrollBarVisibility="Visible" Padding="3" Background="Red">
    <ListView Name="listAnswers" MinWidth="300"/>
</ScrollViewer>
Andrey Shvydky
Not quite so, the red border encloses a scroll bar as well, but it must be inside as is shown on pictures.The thing is ListView has it's own border and it disappears with HorizontalScrollBarVisibility set on scrolling, I don't understand why.
Dmitry
Ok, I already have seen the picture. Give me a minute to check some solution :)
Andrey Shvydky
Dmitry, I have changed my answer, please try another solution.
Andrey Shvydky
Yes, as to the red border, it works, thanks.But in regard to own border of listview, it's not fit, I should've given a real case for example.Please, remove the red border at all and try it out again concerning the own border of Listview inside of ScrollViewer.If HorizontalScrollBarVisibility is set to "Auto" or "Visible" the ListView border starts moving on scrolling.
Dmitry
Well, I think it'd be better to set ListView width to a fixed value to fit inside of scrollviewer, it fixes the problem.
Dmitry