我已经使用列表框中弹出。当我导航到第二次弹出列表框项目不清除。清除列表框项目..请在这个查询中帮助我。 这里是我用过不清除列表框项目当我打开弹出窗口第二次在WP7
<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>
代码按钮单击事件代码:
Private Sub btnAdd_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
PopUp.IsOpen = True
btnAdd.IsEnabled = False
btnBack.IsEnabled = False
btnDelete.Visibility = Windows.Visibility.Collapsed
txtLength.Text = ""
txtwidth.Text = ""
txtsize.Text = ""
CheckBox1.IsChecked = False
ListBox1.IsEnabled = False
TitleLayOut.Opacity = 0.5
LayoutRoot.Background = BrushFromColorName("#AA000000")
txtSearch.IsEnabled = False
btnSearch.IsEnabled = False
ListBox1.Opacity = 0.5
End Sub
我已经使用的添加按钮第一页,它有一个列表框,当我点击按钮弹出将打开..弹出有四个文本框和列表框,有一个链接按钮添加一些细节。细节将显示在列表框中。和这些信息保存在第一页的列表框..当我点击添加第二次弹出项目列表框不清除,这意味着以前的项目显示在这里... PLZ帮助我对这个查询 – vikram 2012-04-17 12:08:22
谢谢你快速响应...我用这个代码..listbox1.clear(),但它显示一个错误。 – vikram 2012-04-17 12:33:04