如何在Silverlight中清除网格 [英] How To clear a Grid in silverlight
问题描述
大家好,
我在silverlight页面中有一个网格,并且在两个按钮上动态地生成了不同的列.
在一个按钮单击事件中,我将创建2行和5列并在每列中的动态Textblock中显示数据,而在另一个按钮单击时,我将创建2行和30列并显示数据.
但这是从两个按钮提供数据.表示它显示的是在单击按钮和第二个按钮上创建的数据.
我想清除以前生成的所有数据记录,新记录应显示在每个click事件上.
谢谢
Hi All,
I have a grid in a silverlight page and generating columns dynamically differently on two button.
In one button click event I am creating 2 rows and 5columns and displaying data in dynamic Textblock in each column and on another button click I am creating 2 rows and 30 columns and displaying data .
But it is giving data from both the button. means it is showing data created on 1 click button and of second button.
I want to clear all the record of previous data generated and new record should be shown on each click event.
Thanks
推荐答案
请仔细阅读中的所有讨论来自DataGrid的数据 [ ^ ]和article Silverlight DataGrid-基础 [
Please go through the discussion in Clear all data from DataGrid[^] and article Silverlight DataGrid - The Basics[^] where they are talking techniques like below.
theDataGrid.Columns.Clear();
private void btnClear_Click(object sender, RoutedEventArgs e)
{
this.sotcDataGrid.ItemsSource = null;
}
希望对您有帮助...
谢谢...
Hope it helps...
Thanks...
这篇关于如何在Silverlight中清除网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!