0

我正在尝试根据CustomerWindow 的 DependancyProperty 是否为空来创建拖动装饰器。我在Window的资源中有这个。绑定的第一部分已设置(被拖动的项目),但第二部分(窗口上的 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 不是元素窗口的直接属性。

  1. 利用<Binding Path="DataContext.Customer"..../>

或者您也可以在绑定中使用 RelativeSource=FindControl Window。

于 2013-01-11T12:17:20.920 回答