gpt4 book ai didi

wpf - 绑定(bind)属性 'width' 中的“自动”值

转载 作者:行者123 更新时间:2023-12-04 06:08:08 24 4
gpt4 key购买 nike

必须附加到属性宽度,我在做什么:

     <ColumnDefinition Width="{Binding Path=TabPanelWidth, RelativeSource={RelativeSource TemplatedParent}}" />

-
     public float TabPanelWidth
{
get {return (float) GetValue (TabPanelWidthProperty);}
set {SetValue (TabPanelWidthProperty, value);}
}
public static readonly DependencyProperty TabPanelWidthProperty = DependencyProperty.Register ("TabPanelWidth", typeof (float), typeof (BivTabControl), new UIPropertyMetadata (null));

但我不仅需要设置固定值,还需要设置在 XAML 中表示为 Auto 的值, 0.5* ,等等。

有任何想法吗?

最佳答案

您的 TabPanelWidth属性必须是 GridLength 类型.与 GridLength您可以使用 GridUnitType 设置自动/星号大小.

事实上,我想知道为什么要绑定(bind)到 float完全有效。

关于wpf - 绑定(bind)属性 'width' 中的“自动”值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8106333/

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