StackPanel 中的 ScrollViewer
<StackPanel Name="mypanel">
<ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight}">
我需要,Height = mypanel.ActualHeight-60
。
我该怎么做呢?
编辑:
<StackPanel Name="mypanel">
<ContentControl Content="{Binding HeaderPart}" /> <= here must be Expander
<ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight, Converter={StaticResource HeightConverter}}" >
<StackPanel>
</StackPanel>
</ScrollViewer>
当没有Expander
时,一切正常。当 Expander
为 mypanel.ActualHeight
时,HeightAdjustmentConverter = 0
。
发生了什么?
<StackPanel Name="mypanel">
<ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight}">
I need, Height = mypanel.ActualHeight-60
.
How can I do it?
EDIT:
<StackPanel Name="mypanel">
<ContentControl Content="{Binding HeaderPart}" /> <= here must be Expander
<ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight, Converter={StaticResource HeightConverter}}" >
<StackPanel>
</StackPanel>
</ScrollViewer>
When there is no Expander
, all is working. When the Expander
is, mypanel.ActualHeight
, HeightAdjustmentConverter = 0
.
What happened?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要编写一个 IValueConverter ,它需要在
ActualHeight
中并返回负 60 的新值。类似于:
You need to write an IValueConverter that takes in the
ActualHeight
and returns a new value of that minus 60.Something like: