private void view_Click(object sender, RoutedEventArgs e) { DBWorker dbConnection = new DBWorker(); DataTable res = new DataTable(); if (dbConnection.isConnected) { if (radioLoadReg.IsChecked == true) { res = dbConnection.ViewAvaliableModels(DbSelect.SelectReg); } if (radioLoadDes.IsChecked == true) { res = dbConnection.ViewAvaliableModels(DbSelect.SelectDes); } if (radioLoadOpt.IsChecked == true) { res = dbConnection.ViewAvaliableModels(DbSelect.SelectTech); } } Window viewer = new Window(); viewer.MaxHeight = 600; viewer.MaxWidth = 900; DataGrid dg = new DataGrid(); dg.ItemsSource = res.AsDataView(); viewer.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; viewer.Content = dg; viewer.Show(); }