我正在尝试添加现有的透视项目(在页面资源中)以进行透视。我尝试this.MainPivot.Items.Add(this.requestPivotItem);
,但它抛出了异常。我也尝试了this.MainPivot.Items.Insert(1,this.requestPivotItem);
但它也引发了异常(但是Argumet例外)。如果我只是把这个pivotItem放到枢轴 - 一切正常。我做错了什么?枢轴项目:
<controls:PivotItem Header="ЗАЯВКИ" x:Name="requestPivotItem">
<Grid Height="600" >
<toolkit:LongListSelector Margin="0,40,0,0" Height="500" SelectionChanged="FindFriendsLLSSelectChanged" x:Name="requestFriendsLLS" Background="Transparent" IsFlatList="True">
<toolkit:LongListSelector.ItemTemplate>
<DataTemplate>
<Grid>
<Line Style="{StaticResource Line1}" ></Line>
<Line Style="{StaticResource Line2}" ></Line>
<TextBlock Margin="75,0,0,0" FontSize="30" Name="Name" Text="{Binding Name}" Height="75" Width="345"/>
<Image HorizontalAlignment="Left" Width="75" Height="75" Name="Photo">
<Image.Source>
<BitmapImage UriSource="{Binding Image}" CreateOptions="BackgroundCreation" />
</Image.Source>
</Image>
<Button Name="Accept" Margin="0,75,0,0" Content="Добавить" />
<Button Name="Disline" Margin="75,75,0,0" Content="Отклонить" />
<Button Name="GetMutural" Margin="75,150,0,0" Content="Общие друзья" />
</Grid>
</DataTemplate>
</toolkit:LongListSelector.ItemTemplate>
</toolkit:LongListSelector>
</Grid>
</controls:PivotItem>
UPD:异常“System.InvalidOperationException”在System.Windows.ni.dll中触发,但未在用户代码中处理。