【发布时间】:2021-03-07 17:40:36
【问题描述】:
单击详细信息时,我希望内容视图上显示的文本应显示在由推送异步创建的新详细信息页面上。如何发送包含内容中给出的信息的参数,例如标题、类别和描述。
我有一个点击手势识别器:
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Label.GestureRecognizers>
这会导致创建一个包含代码的新页面:
private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
await Navigation.PushAsync(new DetailsPage(user), true);
}
那么我应该如何绑定包含标题,描述和类别的标签以显示在点击时创建的新页面中?
这是标签后面的 xaml 代码:
<StackLayout>
<StackLayout Orientation="Horizontal">
<BoxView Color="LightGray"
WidthRequest="90"
HeightRequest="90"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<StackLayout Padding="0">
<Label x:Name="Title" Text="Title"
FontSize="22"
FontFamily="Grotesk"
TextColor="Black"
Margin="10, -2, 0, 0"
VerticalOptions="Fill" />
<Label x:Name="Category" Text="Category"
FontSize="16"
FontFamily="Grotesk"
TextColor="Gray"
Margin="10, -2, 0, 0"
VerticalOptions="Fill" />
<Label x:Name="Desc" Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. etc.etc"
Margin="10, -4, 0, 0"
FontSize="15"
FontFamily="Latow"
VerticalOptions="Start"
MaxLines="3"/>
</StackLayout>
</StackLayout>
【问题讨论】:
标签: c# xaml xamarin xamarin.forms xamarin.android