我需要在标签中显示ShellContent的Title属性。有可能吗?谢谢这是项目菜单的代码
<FlyoutItem Title="My Places" Icon="icon_places.png">
<ShellContent Route="MapsPage" ContentTemplate="{DataTemplate local:MapsPage}" Title="Ayto" />
</FlyoutItem>
I tried with await DisplayAlert("Alert" . . .):
ShellContent.TitleProperty.PropertyName
and
ShellContent.Title
unsuccessfully
您可以将x:name
属性添加到xaml页面。
在后台代码中使用name.title
来获取名称。
这是xaml代码:
<FlyoutItem Title="My Places" Icon="icon_places.png">
<ShellContent Title="Monkeys"
Icon="monkey.png"
ContentTemplate="{DataTemplate views:MainPage}" x:Name="mytest"/>
</FlyoutItem>
这是背景代码:
var titile = mytest.Title;