WPF: {DependencyPropety.UnsetValue} woes

本文关键字:woes UnsetValue DependencyPropety WPF | 更新日期: 2023-09-27 18:36:58

我的绑定有问题,无法修复!我没有显示所需的值,而是得到一个{DependencyProperty.UnsetValue}。

这是XAML

    <TextBlock Visibility="{Binding DisplayBuyPriceConverted, Converter={StaticResource boolVisibilityConverter}}" Grid.ColumnSpan="2" Grid.Row="4">
            <TextBlock.Text>
                <MultiBinding StringFormat="Converted Price: {0} {1}">
                    <Binding Path="BuyPriceConverted" Mode="OneWay"></Binding>
                    <Binding Path="CharterSellPriceCurrency" Mode="OneWay"></Binding>
                </MultiBinding>
            </TextBlock.Text>
    </TextBlock>

这是它以前的样子,工作正常:

    <TextBlock Text="{Binding Path=BuyPriceConverted, StringFormat=Converted Price: {0} GBP, Mode=OneWay}" Margin="5,0,0,0" Width="149" Visibility="{Binding DisplayBuyPriceConverted, Converter={StaticResource boolVisibilityConverter}}" DataContext="{Binding}"></TextBlock>

下面是指定 DataContext 的C#

    public AdditionalCostDialogue(AdditionalCostView additionalCostView)
    {
        InitializeComponent();
        this._additionalCostView = additionalCostView;
        this.DataContext = this.AdditionalCostView;
    }

我做错了什么?

WPF: {DependencyPropety.UnsetValue} woes

我发现我的一个属性是小数。对不起,那些家伙,我带你去追野鹅。现在都在工作。