Wpf 设置属性元素的属性

Wpf 设置属性元素的属性,wpf,xaml,Wpf,Xaml,我有一个图像,我想有一个更大的预览使用工具提示 <Image MaxWidth="585" Margin="2" Source="{Binding Preview, IsAsync=true}"> <Image.ToolTip MaxWidth="800"> <!-- Error: Attribute "MaxWidth" is not allowed in property element --> <Image Source="

我有一个图像,我想有一个更大的预览使用工具提示

<Image MaxWidth="585" Margin="2" Source="{Binding Preview, IsAsync=true}">
    <Image.ToolTip MaxWidth="800"> <!-- Error: Attribute "MaxWidth" is not allowed in property element -->
        <Image Source="{Binding Preview, IsAsync=true}" />
    </Image.ToolTip>
</Image>

如何更改工具提示的
MaxWidth
属性?第二个问题:如何在子绑定中使用父
值?

问题是类型为
对象
,因此它没有
MaxWidth
属性。由于
工具提示
可以接受任意的
对象
,因此要设置
MaxWidth
,您应该在
工具提示
属性中放置一个(或另一个WPF元素),并在该属性上设置
MaxWidth

比如:

<Image MaxWidth="585" Margin="2" Source="{Binding Preview, IsAsync=true}">
    <Image.ToolTip>
        <ToolTip MaxWidth="1000" MaxHeight="600">
            <Image Source="{Binding Preview, IsAsync=true}" />
        </ToolTip>
    </Image.ToolTip>
</Image>