繁体   English   中英

在Pivot控件Windows手机中添加按钮

[英]Add Button in Pivot control Windows phone

我是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>

对的,这是可能的。 这可能真的对你有所帮助

<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>

是的,你需要添加更多的长列表选择器

 <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文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM