开发者

How Can i set List Box with in A pivot

my problem is how can i set listbox which has itemtemplate ,and it also itemteplate of pivot .i don't have any idea to doing this but it is a need of my project .one another is how to set pivot header . i m trying to do something like that

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


You can set the header of a Pivot control to pretty much anything since it is an object. To set it to an image instead of a default title set the Title to "" and do this in the constructor of your page:

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


Did you take a look at the default pivot page setup by visual studio? They do exactly what you're looking for:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜