Jazerix 0 Junior Poster in Training

Hey there
First of all, I'm sorry if the title was a little misleading, wasn't sure how to put it :)

Anyways, I got a pivot control. This pivot controls get's some info from my server, that determines how many tabs, it should add. Each tab uses the design "PivotDesign" i created.
This is what the xaml looks like

<DataTemplate x:Key="PivotDesign">
            <Grid Height="548" Margin="0,0,2,0" >
                <Rectangle RadiusY="11" RadiusX="22" Height="79" Margin="19,12,15,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
                    <Rectangle.Fill>
                        <ImageBrush Stretch="Fill" ImageSource="header_win.png" />
                    </Rectangle.Fill>
                </Rectangle>
                <TextBlock Height="30" HorizontalAlignment="Left" Margin="41,11,0,0" Name="textBlock1" Text="Items:" VerticalAlignment="Top" />
                <Rectangle Fill="#30FFFFFF" Height="432" Margin="18,0,13,12" VerticalAlignment="Bottom" RadiusY="40" RadiusX="47" Grid.ColumnSpan="2"/>
            </Grid>
        </DataTemplate>

the thing is, I want to edit the textblock before it's deployed on the control, for example the textblock would say "1" on page 1 and "2" on page 2, but I have no idea on how to change this, since the code is just loading it from the template I created :)

for (int i = 0; i < items.Count ; i++)
            {
                PivotItem pivI = new PivotItem();
                pivI.ContentTemplate = (DataTemplate)Resources["PivotDesign"];
                pivI.Header = "item " + (i + 1);
                pivI.Margin = new Thickness(12,-15,-389,1);
                pivot_Games.Items.Add(pivI);
            }

how do I go about that?

How can I edit the textblock before i have to add the PivotItem?

Kind Regards
-Jazerix

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.