Windows phone 7 在wp7中第二次打开弹出窗口时未清除列表框项目

Windows phone 7 在wp7中第二次打开弹出窗口时未清除列表框项目,windows-phone-7,Windows Phone 7,我在弹出窗口中使用了列表框。当我第二次导航到弹出窗口时,列表框项目未清除。如何清除列表框项目..请帮助我进行此查询。 这是我使用的代码 <ListBox Background="LightYellow" ItemsSource="{Binding Mode=OneWay, Path= MyPrintingSheetItems}" Grid.ColumnSpan="2" Grid.Row="6" Height="270" HorizontalAlignment="Stretch" Ma

我在弹出窗口中使用了列表框。当我第二次导航到弹出窗口时,列表框项目未清除。如何清除列表框项目..请帮助我进行此查询。 这是我使用的代码

 <ListBox Background="LightYellow" ItemsSource="{Binding Mode=OneWay, Path= MyPrintingSheetItems}"  Grid.ColumnSpan="2" Grid.Row="6"  Height="270" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="ListBox2" VerticalAlignment="Top" Width="440" >
          <ListBox.ItemContainerStyle>
                                   <Style TargetType="ListBoxItem">
                                        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                                    </Style>
                                </ListBox.ItemContainerStyle>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Border BorderThickness="0,0,0,3" BorderBrush="pink" >

                                    <Grid >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="170"/>
                                    <ColumnDefinition Width="90"/>
                                    <ColumnDefinition Width="90"/>
                                    <ColumnDefinition Width="90"/>
                                </Grid.ColumnDefinitions>
                                        <TextBlock Name="lblps" Height="50" Text="{Binding PrintingSheet}" FontSize="26" Grid.Column="0"  VerticalAlignment="Center" Margin="0,0, 0, 0" HorizontalAlignment="Center" Foreground="Black" />
                                        <TextBlock Height="50" Name="lblnrml" Text="{Binding Normal}" FontSize="26" Grid.Column="1" Margin="0,0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" />
                                        <TextBlock Height="50" Name="lblhvy" Text="{Binding Heavy}" FontSize="26" Grid.Column="2" Margin="0,0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" />
                                        <TextBlock Height="50" Name="lblmetal" Text="{Binding Metal}" FontSize="26" Grid.Column="3" Margin="0,0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" />

                                        </Grid>
                                </Border>

                                </DataTemplate>

                            </ListBox.ItemTemplate>
                        </ListBox>

当您打开弹出窗口时,请通过

listBox1.Items.Clear();

我在第一页使用了添加按钮,它有一个列表框,当我点击按钮时弹出窗口将打开。弹出窗口有四个文本框和列表框,有一个用于添加一些详细信息的链接按钮。详细信息将显示在列表框上。这些信息保存在第一页列表框中..当我第二次单击“添加”时,弹出项目列表框未被清除,这意味着前面的项目显示在这里…请在此查询中帮助我为您快速响应。。。我使用了以下代码..listbox1.clear(),但它显示了一个错误。感谢您的快速响应。。。我使用了以下代码..listbox1.clear(),但它显示了一个错误;这将错误显示为运行时只读集合上不支持的操作。。。
listBox1.Items.Clear();