【发布时间】:2013-02-14 17:36:18
【问题描述】:
<Canvas Background="Black">
<Rectangle Fill="Salmon" Name="selBox" Width="100" Height="100" Margin="657,175" />
<Button x:Name="btnAnimate" Content="Animate" HorizontalAlignment="Left" Margin="721,422,0,0" VerticalAlignment="Top" Click="btnAnimate_Click" />
</Canvas>
是我的 XAML。我已经写在 MainPage.xaml.cpp 文件中
void App1::MainPage::btnAnimate_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
auto x = Canvas::GetLeft(selBox);
}
当我调试应用程序时,我总是得到0.00 for x。为什么这样?还是有一些关于父母的翻译?我还尝试将 Canvas 命名为 myCanvas 并命名为 myCanvas->GetLeft(selBox);,但我仍然得到相同的结果。
【问题讨论】:
标签: windows-store-apps winrt-xaml c++-cx