0

CustomerWindowの DependancyProperty が null であるかどうかに基づいてドラッグ アドナーを作成しようとしています。これはウィンドウのリソースにあります。バインディングの最初の部分 (ドラッグされる項目) は設定されますが、2 番目 (ウィンドウの DependancyProperty) は UnsetValue として表示されます。

プロパティは、ウィンドウのデータ コンテキストとして使用されるため、確実に初期化されます。

<Window x:Name="root"
    ...
>
<Window.Resources>
    <DataTemplate x:Key="DragAdorner">
        <StackPanel Orientation="Horizontal">
            <TextBlock>
                <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource vehicleDragConverter}">
                        <Binding/>
                        <Binding Path="Customer" ElementName="root"/>
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
        </StackPanel>
</DataTemplate>
4

1 に答える 1

0

customer は要素 window の直接のプロパティではありません。

  1. 使用する<Binding Path="DataContext.Customer"..../>

または、バインディングで RelativeSource=FindControl Window を使用することもできます。

于 2013-01-11T12:17:20.920 に答える