user3821206
user3821206

Reputation: 619

a TopAppbar and BottomAppBar for WindowsPhone

I have a TopAppbar and BottomAppBar in my universal app,I want to create the same AppBars in my windows phone 8,this is my code:

<Page.TopAppBar>
        <CommandBar HorizontalContentAlignment="Stretch" Background="#FF00AEEF">
            <CommandBar.Content >
                <Grid>
                    <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Left">
                        <StackPanel Orientation="Horizontal" >
                            <Image Margin="2" Height="35" Source="images/4.png" Width="35"/>
                        </StackPanel>
                        <Button VerticalAlignment="Stretch" Background="#FF00AEEF" x:Name="HomeBtn" Click="HomeBtn_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="images/berry.png" Height="35" Width="35" />
                                <TextBlock Text="BarBerry"  Foreground="White"></TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <Button VerticalAlignment="Stretch" Background="#FF00AEEF" Style="{StaticResource CustomButtonStyle}" Margin="5,0">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Contact" Foreground="White"></TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </Grid>
            </CommandBar.Content>
        </CommandBar>
    </Page.TopAppBar>

    <Page.BottomAppBar>
        <CommandBar Background="#eff0f2" HorizontalContentAlignment="Stretch">
            <CommandBar.Content>
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch">
                        <Image Source="images/world.png" Height="35" Width="35" Margin="5,0"/>
                        <ComboBox Margin="2" BorderThickness="0" SelectedItem="test" x:Name="combo">
                            <ComboBoxItem Content="test" />
                            <ComboBoxItem Content="test1" />
                        </ComboBox>
                    </StackPanel>
                </Grid>
            </CommandBar.Content>
        </CommandBar>
    </Page.BottomAppBar>

but the problem is that,I get only the BottomAppBar displayed,is it possible to define in windows Phone 8 a Top and a Bottom AppBars,should I use a StackPanel in place of the Top appBar?

thanks for help

Upvotes: 0

Views: 98

Answers (1)

Saurabh Srivastava
Saurabh Srivastava

Reputation: 1113

You can't create the Top App Bar in windows phone. Because their is only Bottom App Bar is defined in the Windows phone project. So you can only define the bottom app bar in windows phone.Yes you can use the Stack panel instead of Top App bar but i think this is not a good idea to implement that kind of functionality in windows phone :).

Upvotes: 1

Related Questions