Aki*_*24x 10 wpf binding listbox scrollbar
我想知道如果可见,如何获取或计算没有垂直滚动条的ListBox的实际宽度.
我想要做的是改变ListBox中每个项目的宽度而不被Vertical Scrollbar覆盖.
Width="{Binding ActualWidth,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}
Run Code Online (Sandbox Code Playgroud)
至少,上面的绑定告诉我ListBox的实际宽度,但是这个不处理垂直滚动条的宽度.
有什么好方法可以解决这个问题吗?
Mår*_*röm 27
尝试绑定到ViewportWidth包含的属性ScrollViewer.
像这样:
Width="{Binding Path=ViewportWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ScrollViewer}}"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4861 次 |
| 最近记录: |