Решение: Вы можете определить пользовательское представление как панель навигации вашего контента на определенной платформе (Android). Обратитесь к следующему коду.
public partial class Page1 : ContentPage
{
public Page1 ()
{
InitializeComponent ();
if(Device.RuntimePlatform=="Android")
{
NavigationPage.SetHasBackButton(this, false);
NavigationPage.SetTitleView(this, SetBackView("Title", "back"));
}
}
private void BackButton_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
StackLayout SetBackView (string title,string backButtonContent)
{
Button backButton = new Button()
{
Text = backButtonContent,
TextColor = Color.White,
FontAttributes=FontAttributes.None,
BackgroundColor = Color.Transparent,
Margin = new Thickness(-20,0,0,0),
};
backButton.Clicked += BackButton_Clicked;
StackLayout stackLayout = new StackLayout
{
Children = {
backButton,
new Label{
HorizontalTextAlignment=TextAlignment.Center,
VerticalTextAlignment=TextAlignment.Center,
Text=title,
TextColor=Color.White,
BackgroundColor=Color.Transparent,
},
},
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.StartAndExpand,
Orientation = StackOrientation.Horizontal,
};
return stackLayout;
}
}
И эффект, как показано ниже, вы можете установить содержимое заголовка страницы и backButton
, как вы хотите.
You could use Select in the first list, use the item index and access the element on the second list:
var a = new [] {1,2,3,4};
var b = new [] {5,6,7,8};
var qry = a.Select((i, index) => new {i, j = b[index]});