2017-01-20 4 views
0

Я работаю в VisualStudio 2015, и там я создал проект Xamarin. Я хочу, чтобы переписать мой старый проект на Xamarin.Forms У меня проблема с созданием BottomAppBar. Если у Xamarin.Forms что-то похожее на BottomAppBar? Мой код в XAML было так:Xamarin - создание пользовательского интерфейса с использованием ContentPage

<Page 
    x:Class="App.View.StartView" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:App.View" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
> 

    <Grid> 
     <Grid.Background> 
      <ImageBrush 
       Stretch="UniformToFill" 
       ImageSource="{ThemeResource BackgroundPath}"/> 
     </Grid.Background> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*"/> 
      <ColumnDefinition Width="10*"/> 
      <ColumnDefinition Width="*"/> 
     </Grid.ColumnDefinitions> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="1*"/> 
      <RowDefinition Height="1*"/> 
     </Grid.RowDefinitions> 
     <TextBlock 
      x:Uid="heading" 
      VerticalAlignment="Center" 
      HorizontalAlignment="Right" 
      Grid.Column="1" 
      Grid.Row="0" 
      TextAlignment="Right" 
      FontFamily="{ThemeResource FontFamily}" 
      FontWeight="{ThemeResource FontWeightHeader}" 
      FontSize="{ThemeResource FontSizeHeader}"/> 

    </Grid> 
    <Page.BottomAppBar> 
     <CommandBar 
      Background="{ThemeResource CommandBarBackgroundBrush}"> 
      <CommandBar.PrimaryCommands> 
       <AppBarButton 
        x:Uid="startAppBarButton" 
        Icon="Play" 
        Command="{ Binding StartCommand}"/> 
      </CommandBar.PrimaryCommands> 
      <CommandBar.SecondaryCommands> 
       <AppBarButton 
        x:Uid="settingsButton" 
        Command="{Binding SettingsCommand}"/> 
       <AppBarButton 
        x:Uid="aboutButton" 
        Command="{Binding InfoCommand}"/> 
       <AppBarButton 
        x:Uid="helpButton" 
        Command="{Binding HelpCommand}"/> 
      </CommandBar.SecondaryCommands> 
     </CommandBar> 
    </Page.BottomAppBar> 
</Page> 

На данный момент я не так много, но я пытаюсь сделать вид, насколько похожи, как мой предыдущий вид и до сих пор у меня есть:

<?xml version="1.0" encoding="utf-8"?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
     xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS" 
     xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android" 
     xmlns:formsAndroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android" 
     xmlns:winControls="clr-namespace:Windows.UI.Xaml.Controls;assembly=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime;targetPlatform=Windows" 
     xmlns:local="clr-namespace:NativeViewInsideContentView" 
     x:Class="NativeViewInsideContentView.NativeViewInsideContentViewPage" 
     BackgroundImage="Background.png" 
     > 


    <StackLayout Margin="20"> 
     <Button Text="Click Me!" 
      HorizontalOptions="Center" 
      VerticalOptions="CenterAndExpand" 
       /> 
    </StackLayout> 


</ContentPage> 

ответ

1

Вот вам, чтобы вы начали. Оттуда вы сможете выполнить Google или Bing:

Page => ContentPage 
Grid => Grid 
StackPanel => StackLayout 
TextBlock => Label 
Page.BottomAppBar => ContentPage.ToolbarItems 
Смежные вопросы