【发布时间】:2020-10-27 10:01:17
【问题描述】:
我有一个简单的Page 和一个TextBlock,我想在其中显示它的ActualHeight 和ActualWidth。
<Page
x:Class="HaproPlace2.Views.Calibration.CalibrationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="1080"
d:DesignWidth="1920"
x:Name="Page1">
<Grid>
<TextBlock Text="{Binding ElementName=Page1, Path=ActualHeight}" Foreground="LimeGreen" />
</Grid>
</Page>
当app 启动时,它会显示正确的值,但在调整page/window 的大小时不会更新。如果通过ElementName 绑定到dependencyProperty,uwp 中有什么特别之处可以让它自动更新ui?
【问题讨论】:
标签: data-binding uwp uwp-xaml