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>