2014-01-30 35 views
0

按钮 “playsound” 显示细腻本身,但每当我添加 “按钮2” 我得到以下错误:2个按钮在XAML WP8手机:PivotItem

Property content is set more than once.

Invalid Markup.

在我的设计

视图。我如何在透视中获得多个按钮?

<phone:PivotItem CacheMode="{x:Null}" Header="Audio" Margin="41,30,8,-58"> 
    <Button x:Name="button2" Margin="61,301,0,0" Content="hello" Height="22" Width="33"></Button> 
    <Button x:Name="playsound" HorizontalAlignment="Left" Margin="61,451,0,0" 
           VerticalAlignment="Top" Height="109" Width="256"> 
     <Grid Height="138" Width="293" RenderTransformOrigin="0.349,0.43"> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width ="110"/> 
       <ColumnDefinition Width ="110"/> 
      </Grid.ColumnDefinitions> 
      <TextBlock Grid.Column="0" Margin="0,0,0,68"> 
       <Run Text="יום ראשון&#10;"/> 
       <Run Text="Sunday"/> 
      </TextBlock> 
      <TextBlock Grid.Column="1" Margin="0,0,0,68"> 
       <Run Text="פרק כד&#10;"/> 
       <Run Text="Psalm 24"/> 
      </TextBlock> 
     </Grid> 
    </Button>      
</phone:PivotItem> 
+0

窝在StackPanel中,BRO(两个按钮: –

回答

1

应该将一个容器元素内的两个按钮,诸如GridStackPanel

<Grid> 
    //Buttons here 
</Grid> 

<StackPanel> 
    //Buttons here 
</StackPanel> 
0

试试这个。 PivotItem只允许一个子元素。这就是为什么你会得到错误。使用像Stackpanel或Grid这样的Container控件作为PivotItem的子项。

<phone:PivotItem CacheMode="{x:Null}" Header="Audio" Margin="41,30,8,-58"> 
<StackPanel> 
    <Button x:Name="button2" Content="hello" Height="22" Width="33"/> 
    <Button x:Name="playsound" HorizontalAlignment="Left" 
    VerticalAlignment="Top" Height="109" Width="256"> 
         <Grid Height="138" Width="293" RenderTransformOrigin="0.349,0.43"> 
          <Grid.ColumnDefinitions> 
           <ColumnDefinition Width ="110"/> 
           <ColumnDefinition Width ="110"/> 
          </Grid.ColumnDefinitions> 
          <TextBlock Grid.Column="0" Margin="0,0,0,68"> 
           <Run Text="יום ראשון&#10;"/> 
           <Run Text="Sunday"/> 
          </TextBlock> 
          <TextBlock Grid.Column="1" Margin="0,0,0,68"> 
          <Run Text="פרק כד&#10;"/> 
          <Run Text="Psalm 24"/> 
          </TextBlock> 
         </Grid> 
        </Button> 
    </StackPanel>     
</phone:PivotItem>