2017-01-20 13 views
0

Ich arbeite in VisualStudio 2015 und dort habe ich Xamarin-Projekt erstellt. Ich möchte mein altes Projekt in Xamarin.Forms umschreiben Ich habe ein Problem mit der Erstellung von BottomAppBar. Wenn Xamarin.Forms etwas Ähnliches wie BottomAppBar hat? Mein Code in XAML war wie folgt aus:Xamarin - Erstellen von UI mit 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> 

Denn jetzt habe ich nicht so viel, aber ich versuche, um so weit ähnlich wie meine vorherige Ansicht zu machen und so weit ich habe:

<?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> 

Antwort

1

Hier ist es, um loszulegen. Von dort aus können Sie Google oder Bing Ihren Weg nach draußen:

Page => ContentPage 
Grid => Grid 
StackPanel => StackLayout 
TextBlock => Label 
Page.BottomAppBar => ContentPage.ToolbarItems 
Verwandte Themen