Do you mean that you're trying to clear the items in the Datagrid and then load the data from another dataset?
If that's the case, something like:
if(datagrid.itemsource != null)
datagrid.itemsource = null;
and then provide a new datasource like you're already doing above:
dataGrid1.ItemsSource = ds.DefaultView;