【发布时间】:2013-06-10 13:39:42
【问题描述】:
<Button>
<Button.Content>
<MultiBinding StringFormat="{}{0},{1}">
<Binding Path="Width" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}"/>
<Binding Path="Height" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}"/>
</MultiBinding>
</Button.Content>
</Button>
这里我尝试将窗口的宽度和高度绑定到按钮内容中,但没有任何意义。
【问题讨论】:
-
StringFormat 要求目标是字符串类型。
-
你想达到什么目标?我不明白。如果您使用多重绑定,您还应该使用多重转换器。
标签: wpf multibinding