当您单击 GraphicsView 时,应该发生一个事件并且应该调用 tap 方法,但是调试器不会以任何方式对该区域中的单击做出反应。并且标签不会改变其含义。
XAML:
<Label
x:Name="lb"
Text="You touch nothing"/>
<GraphicsView
x:Name="tralala"
StartInteraction="tap"/>
CS:
private void tap(object sender, TappedEventArgs e)
{
lb.Text = "You touch my tralala"
}
您需要设置它 -
Heightrequest并且Widthrequest在 GraphicsView 参数中,因为默认情况下它们等于-1。