gpt4 book ai didi

c# - WPF 行高绑定(bind)在用户使用 GridSplitter 后停止工作

转载 作者:太空狗 更新时间:2023-10-30 01:05:05 24 4
gpt4 key购买 nike

我有一个四行的网格:

<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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com