我有一个四行的网格:
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding DocumentsHeight}"/>
<RowDefinition Height="Auto"/> - GRIDSPLITTER
<RowDefinition Height="{Binding ApprovedDocumentsHeight}" />
</Grid.RowDefinitions>
行的动态大小调整工作正常,高度绑定(bind)到值如“5*”的字符串。但是当用户使用 GridSplitter 时,绑定(bind)停止工作,当我想更改行的大小时,在下一次通知之后不会调用 getter。有人知道问题出在哪里吗?
感谢您的帮助。
最佳答案
如果您绑定(bind)到 GridLength 以外的任何东西,绑定(bind)将会中断。 您可以像这样绑定(bind)到 GridLength 属性...
private double documentsHeight = 100;
public GridLength DocumentsHeight
{
get { return this.GridLength(this.documentsHeight); }
set { this.documentsHeight = value.Value; }
}
此外,您还需要在绑定(bind)上设置 Mode=TwoWay。
关于c# - WPF 行高绑定(bind)在用户使用 GridSplitter 后停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20124175/