wpf datagrid очистить

заполняю DataGrid

DataSet ds = new DataSet();

sqlitecommand = new SQLiteCommand("select * from " + name, sqliteconnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlitecommand);
adapter.Fill(ds);
dgrid.ItemsSource = ds.Tables[0].DefaultView;

теперь мне нужно очистить DataGrid

dgrid.Items.Clear();

получаю

System.InvalidOperationException: "Операция недопустима, когда ItemsSource используется. Вместо этого получите доступ и измените элементы с помощью ItemsControl.ItemsSource."

как очистить DataGrid?


Ответы (0 шт):