【发布时间】:2017-08-22 12:05:33
【问题描述】:
我有一个ListView 和这样的Grid DataTemplate 定义:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="Tb" Text="{x:Bind Address}" TextWrapping="Wrap"/>
<Image Source="{x:Bind SignalResource}" Height="{Binding ElementName=Tb, Path=ActualHeight}"/>
</Grid>
我想要Image 取TextBlock's 的高度,但是我的Binding 不起作用(据我了解-因为当绑定解决后,View 的ActualHeight 仍然为0)
问题是如何将Image高度绑定到TextBlock高度?
【问题讨论】:
-
这个问题能解决你的问题吗:stackoverflow.com/questions/2232675/… ?
-
@EamonnMcEvoy,不遗憾(如果我理解正确的话)。我偶然放置了有问题的WPF标签。我正在开发 UWP 应用,但 SharedSizeGroup 在那里不可用(仍然不确定)