说明:{Binding ElementName=grid0, Path=Height}
ElementName=grid0:查找到名为grid0的控件。
, Path=Height:获取名为grid0的控件的Height属性值。
即:将Lb1的属性值设置为grid0控件的Height属性设置值。
<Grid Name="grid0"> <Grid> <StackPanel Background="AliceBlue"> <Border HorizontalAlignment="Left" Height="30" Cursor="Hand" Panel.ZIndex="2"> <Label Content="返回" HorizontalAlignment="Left" MouseLeftButtonUp="Label_MouseLeftButtonUp"></Label> </Border> <Border VerticalAlignment="Top" Margin="0,-30,0,0"> <Label name="Lb1" Content="123" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Height="{Binding ElementName=grid0, Path=Height}" FontSize="28" FontFamily="微软雅黑"></Label> </Border> </StackPanel> </Grid> </Grid>