[英]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.