2014-01-30 37 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>