简体   繁体   English

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

[英]Add Button in Pivot control Windows phone

I am new to windows phone, 我是Windows手机的新手,

I want to add button only in Pivot item two is it possible to add ? 我想在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>

Please help and thanks in advance. 请提前帮助和感谢。

Edit: 编辑:

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

Yes it is possible. 对的,这是可能的。 This may be really help you 这可能真的对你有所帮助

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

Edit 编辑

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

Yes it's possible For Long List Selector You Need to Add Some More 是的,你需要添加更多的长列表选择器

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

For LongListSelector Add this Code 对于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>

And Add AlphaKeyGroup.cs File From Hear 并从听到添加AlphaKeyGroup.cs文件

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

相关问题 Windows Phone 8 Pivot控件虚拟化 - Windows Phone 8 Pivot control virtualization 停止在Windows Phone 8中循环执行枢轴控制 - Stop looping pivot control in windows phone 8 在Windows Phone 7上使用Monocross和Panorama和/或Pivot控件 - Using Monocross on Windows Phone 7 with Panorama and/or Pivot control 使用Observable Collection MVVM绑定透视图控件(Windows Phone 8) - Binding Pivot control with Observable Collection MVVM (windows phone 8) XAML - Windows Phone 8,使用Pivot Control缓慢加载 - XAML - Windows Phone 8, loading slowly using Pivot Control 在WinRT中创建控件Windows Phone Silverlight之类的枢轴并绑定项目 - Create pivot like control Windows Phone Silverlight in WinRT and bind Items 使用Windows Phone 8.0上的嵌入式WebBrowser对滑动控件进行滑动操作 - Making swipe work for a pivot control with embedded WebBrowser on Windows Phone 8.0 Windows Phone应用程序中的“后退”按钮控件 - Back button control in windows phone app 如何动态添加单选按钮并将其显示在单击按钮的地图控件中(Windows Phone 8.1) - How to add radio buttons dynamically and display them in a button click in map control(windows phone 8.1) 如何将TimePicker控件添加到Windows Phone 8应用程序? - How to add a TimePicker control to a Windows Phone 8 app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM