1

I need to know how can I know when a ListView is vertical scrolling, to adjust some alignment in other components.

Something like this:

<ListView x:Name="lvList"
          ScrollViewer.VerticalScrollBarVisibility="Auto"
          ItemsSource="{Binding ... , Mode=OneWay}"
          SelectedItem="{Binding ...}">

<TextBlock Text="..."
           HorizontalAlignment="{Binding ComputedVerticalScrollBarVisibility, ElementName=lvList.ScrollViewer ,Converter={StaticResource AlightByScroll}}"/>

I have tried putting the ListView inside ScrollViewer and it works, but then I have another problem with scrollViewer and touch scrolling. So I need to solve my problem knowing when the vertical scroll bar is visible in my ListView.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Casama
  • 11
  • 1
  • Does this answer your question? [WPF - Listview scrollbar not showing up](https://stackoverflow.com/questions/46787272/wpf-listview-scrollbar-not-showing-up) – Sandeep Jadhav Dec 28 '21 at 21:29
  • Does this answer. https://stackoverflow.com/q/6221813/7300644 – Sandeep Jadhav Dec 28 '21 at 21:39
  • There is no event that allows to observe the visibility of the Scrollbar. Generally, it is highly recommended to enable the ScrollBar explicitly when you can anticipate that the content is likely to exceed the available space. Having the visibility set to `Auto` results in very bad perfomance. It also eliminates the need to care about the visibility. Of course, you can always bind to the attached `ScrollViewer.VerticalScrollBarVisibility` property or implement layout triggers based on this attached property. – BionicCode Dec 28 '21 at 22:03
  • Hi Sandeep Jadhav . thanks for answer, but they are different questions, Please be advised that my problem its different – Casama Dec 29 '21 at 13:25
  • Hi BoinicCode. thanks for answering. You meant this one....ScrollViewer.VerticalScrollBarVisibility="{Binding MyScrollVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}".... I have tried this one too. (ScrollViewer.VerticalScrollBarVisibility binding) but the problem its that for any reaseon, if I change the value in the ViewModel, the View will updated without any problem, but if the View needs to show the scroll, the ViewModel dont update the value to "Visible"... – Casama Dec 29 '21 at 13:29

0 Answers0