我是Windows手机新手,
我只想在Pivot item two
中添加按钮是否可以添加?
<!--Pivot Control-->
<phone:Pivot Margin="0,20,0,0">
<!--Pivot item one-->
<phone:PivotItem Header="one">
**I Want to add Button here**
**I Want to add LongListSelector here**
</phone:PivotItem>
<!--Pivot item two-->
<phone:PivotItem Header="two">
....
</phone:PivotItem>
<!--Pivot item three-->
<phone:PivotItem Header="three">
....
</phone:PivotItem>
</phone:Pivot>
请提前帮助和致谢。
修改
<phone:PivotItem Header="Events" Margin="12,74,12,0">
<StackPanel>
</StackPanel>
<StackPanel>
<phone:LongListSelector Margin="0,-20,-12,0" ItemsSource="{Binding Items}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</StackPanel>
</phone:PivotItem>
答案 0 :(得分:3)
是的,这是可能的。这可能真的对你有帮助
<phone:Pivot Margin="0,20,0,0">
<!--Pivot item one-->
<phone:PivotItem x:Name="pivotitem1">
<phone:PivotItem.Header>
<StackPanel>
<Button Content="Pivot Header" Width="100"/>
</StackPanel>
</phone:PivotItem.Header>
<StackPanel>
</StackPanel>
</phone:PivotItem >
<!--Pivot item two-->
<phone:PivotItem Header="two">
....
</phone:PivotItem>
<!--Pivot item three-->
<phone:PivotItem Header="three">
....
</phone:PivotItem>
</phone:Pivot>
修改强>
<phone:PivotItem Header="Events" Margin="12,74,12,0">
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="Pivot Header" Width="100" Grid.Row="0"/>
<StackPanel Grid.Row="1">
<phone:LongListSelector Margin="0,-20,-12,0" ItemsSource="{Binding Items}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</StackPanel>
</Grid>
</phone:PivotItem>
答案 1 :(得分:0)
是的,这是可能的 对于长列表选择器,您需要添加更多
<phone:Pivot Margin="0,20,0,0">
<!--Pivot item one-->
<phone:PivotItem x:Name="pivotitem1">
<phone:PivotItem.Header>
<StackPanel>
<Button Content="Header Name " Width="100"/>
</StackPanel>
</phone:PivotItem.Header>
<Grid>
<phone:LongListSelector
x:Name="LongListSelectorName"
JumpListStyle="{StaticResource AddrBookJumpListStyle}"
Background="Transparent"
GroupHeaderTemplate="{StaticResource AddrBookGroupHeaderTemplate}"
ItemTemplate="{StaticResource AddrBookItemTemplate}"
LayoutMode="List"
IsGroupingEnabled="true"
HideEmptyGroups ="true" Margin="0,10,0,0"/>
</Grid>
</phone:PivotItem >
<!--Pivot item two-->
<phone:PivotItem Header="two">
....
</phone:PivotItem>
</phone:Pivot>
对于LongListSelector添加此代码
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="AddrBookItemTemplate">
<StackPanel VerticalAlignment="Top" Orientation="Horizontal">
<Image Width="62" Height="62" Source="/Assets/Alert.png" VerticalAlignment="Top" Margin="0,0,15,0"/>
<TextBlock FontSize="30" Width="250" Text="{Binding LastName}" Margin="5,10,0,0" />
<Button Width="120" Height="70" Content="Invet" Margin="2,2"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="AddrBookGroupHeaderTemplate">
<Border Background="Transparent" Padding="5">
<Border Background="#FF0E62EE" BorderThickness="2" Width="62"
Height="62" Margin="0,0,18,0" HorizontalAlignment="Left">
<TextBlock Text="{Binding Key}" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="48" Padding="6"
FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</Border>
</DataTemplate>
<phone:JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
<phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>
<Style x:Key="AddrBookJumpListStyle" TargetType="phone:LongListSelector">
<Setter Property="GridCellSize" Value="113,113"/>
<Setter Property="LayoutMode" Value="Grid" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Border Background="#FF0E62EE" Width="113" Height="113" Margin="6" >
<TextBlock Text="{Binding Key}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="48" Padding="6"
Foreground="{Binding Converter={StaticResource ForegroundConverter}}" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
并添加AlphaKeyGroup.cs文件 来自Hear