Albert Gao
Albert Gao

Reputation: 3769

Questions when customize the header of a pivotitem

try to customize the header of each PivotItem, i google first and write code below, this is OK:

<controls:Pivot Title="MyPivot">
    <!--Pivot item one-->
    <controls:PivotItem>
        <controls:PivotItem.Header>
            <TextBlock Text="Pivot1" FontSize="40"/>
        </controls:PivotItem.Header>
        <Grid/>
    </controls:PivotItem>
</controls:Pivot>

when I add the second pivot item in this way, an error appears as "Value does not fall within the expected range.",the error starts from [controls:PivotItem] of "pivot item two",

<controls:Pivot Title="MyPivot">
    <!--Pivot item one-->
    <controls:PivotItem>
        <controls:PivotItem.Header>
            <TextBlock Text="Pivot1" FontSize="40"/>
        </controls:PivotItem.Header>
        <Grid/>
    </controls:PivotItem>

    <!--Pivot item two-->
    <controls:PivotItem>
        <controls:PivotItem.Header>
            <TextBlock Text="Pivot2" FontSize="40"/>
        </controls:PivotItem.Header>
        <Grid/>
    </controls:PivotItem>
</controls:Pivot>

When I build the project, the error just gone away, and the whole app runs like a charm. But everytime i add a new pivot item in this way, the error shows up.

My questions are:

  1. why does this error happen and how to solve it?
  2. can I ignore this error?

Upvotes: 3

Views: 998

Answers (1)

MAXE
MAXE

Reputation: 5152

This "error" is thrown just at design-time, and I think you can ignore it. Also, it will go definitively away the first time you build the project (so it means there are no real problems in your project, and also no warnings)!

There are more of this type of errors thrown by the designer.

Ignore it!

Upvotes: 3

Related Questions