[英]2 buttons in xaml wp8 phone:PivotItem
按鈕“ playsound”本身顯示正常,但是每當我添加“ button2”時,都會出現以下錯誤:
屬性內容設置多次。
和
無效的標記。
在我的設計視圖中。 如何在軸上獲得多個按鈕?
<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="יום ראשון "/>
<Run Text="Sunday"/>
</TextBlock>
<TextBlock Grid.Column="1" Margin="0,0,0,68">
<Run Text="פרק כד "/>
<Run Text="Psalm 24"/>
</TextBlock>
</Grid>
</Button>
</phone:PivotItem>
您應該將兩個按鈕放置在諸如Grid
或StackPanel
類的容器元素內:
<Grid>
//Buttons here
</Grid>
要么
<StackPanel>
//Buttons here
</StackPanel>
嘗試這個。 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="יום ראשון "/>
<Run Text="Sunday"/>
</TextBlock>
<TextBlock Grid.Column="1" Margin="0,0,0,68">
<Run Text="פרק כד "/>
<Run Text="Psalm 24"/>
</TextBlock>
</Grid>
</Button>
</StackPanel>
</phone:PivotItem>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.