private void InputFile_Click(object sender, RoutedEventArgs e) { var inputFileWindow = new InputFileWindow(); if (inputFileWindow.ShowDialog() == true) { input = new KnapsackInput(); input.ReadInput(inputFileWindow.FileName); } allItemsGrid.DataContext = input.Items; itemsGrid.DataContext = null; resultTextBlock.Text = "Result of the solution will be displayed here"; }