2011-08-18 189 views
0

我的问题是我如何设置列表框,其中itemtemplate,它也项目的枢轴点 。我没有任何想法做到这一点,但它是一个需要我的另一个是如何设置pivot header。我想要做这样的事情我怎样才能设置列表框在一个枢轴点

 <controls:Pivot Height="779" Name="m" > 
     <controls:Pivot.Background> 
     <ImageBrush ImageSource="/WindowsPhoneApplication7;component  
     /Images/S.jpeg" /> 
    </controls:Pivot.Background> 
    <!--<controls:PivotItem Name="all" >--> 
    <controls:Pivot.ItemTemplate> 
     <DataTemplate> 
      <ListBox Height="450" HorizontalAlignment="Stretch" Margin="8,6,0,0" Name="listBox1" VerticalAlignment="Stretch" Background="#00537393" Width="445" > 
       <ListBox.ItemTemplate > 
        <DataTemplate > 

         <Border BorderBrush="Black" CornerRadius="8" BorderThickness="1" HorizontalAlignment="Stretch" Name="border"> 

          <Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch"> 

           <Grid.RowDefinitions> 
            <RowDefinition Height="0*" /> 
            <RowDefinition Height="100*" /> 
           </Grid.RowDefinitions> 
           <Image Height="78" HorizontalAlignment="Left" Margin="13,12,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="92" Grid.Row="1" Source="{Binding ImageSource}" /> 
           <TextBlock Foreground="White" Height="80" HorizontalAlignment="Left" Margin="111,12,0,0" Name="textBlock1" Text="{Binding Title}" VerticalAlignment="Top" Width="280" TextWrapping="Wrap" Grid.Row="1" /> 
           <Image Grid.Row="1" Height="75" HorizontalAlignment="Left" Margin="380,12,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="73" Source="/WindowsPhoneApplication7;component/Images/appbar.transport.play.rest.png" /> 

           <TextBlock Foreground="White" Grid.Row="1" Height="20" HorizontalAlignment="Left" Margin="111,88,0,0" Name="textBlock2" Text="{Binding date}" VerticalAlignment="Top" Width="190" FontSize="11" /> 
          </Grid> 

         </Border> 
        </DataTemplate> 
       </ListBox.ItemTemplate> 
      </ListBox> 
     </DataTemplate> 
    </controls:Pivot.ItemTemplate> 
    <controls:Pivot.HeaderTemplate> 
     <DataTemplate> 
      <TextBlock Text="hiii" TextWrapping="Wrap" FontSize="0" Foreground="White" /> 
     </DataTemplate> 
    </controls:Pivot.HeaderTemplate> 
</controls:Pivot> 

回答

0

您可以在枢轴控件的标题设置为几乎任何东西,因为它是一个对象。将其设置为一个图像,而不是默认的标题设置的标题在你的页面的构造函数“”和这样做:

YourPivotControl.Title = new Image { Width = 400, Source = new BitmapImage(new Uri("/someImage.png", UriKind.Relative)) }; 
0

你看看通过Visual Studio中的默认轴页面设置?他们正在做你正在寻找的东西:

<!--Pivot Control--> 
    <controls:Pivot Title="MY APPLICATION"> 
     <!--Pivot item one--> 
     <controls:PivotItem Header="first"> 
      <!--Double line list with text wrapping--> 
      <ListBox x:Name="FirstListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}"> 
       <ListBox.ItemTemplate> 
        <DataTemplate> 
         <StackPanel Margin="0,0,0,17" Width="432" Height="78"> 
          <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/> 
          <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/> 
         </StackPanel> 
        </DataTemplate> 
       </ListBox.ItemTemplate> 
      </ListBox> 
     </controls:PivotItem>