I\'d like to change the properties of a ScrollViewer of a ListBox from C#.
I found this question here on Stackoverflow. I took the accepted
The properties of the ScrollViewer are "attached" to the ListBox (cf. https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/attached-properties-overview). You can get or set it as for a dependency property by the functions:
public object GetValue (System.Windows.DependencyProperty dp);
and
public void SetValue (System.Windows.DependencyProperty dp, object value);
For example, for the listbox 'lb', you can write:
lb.GetValue(ScrollViewer.ActualHeightProperty);
or
lb.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Visible);