private void MetricsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (ButtonShortReturn.Visibility == Visibility.Visible) { var firstSelectedCellContent = this.MetricsDataGrid.Columns[0].GetCellContent(this.MetricsDataGrid.SelectedItem); var firstSelectedCell = firstSelectedCellContent != null ? firstSelectedCellContent.Parent as DataGridCell : null; string s = WorkWithExcel.Find(Environment.CurrentDirectory + "/thrlist.xlsx", Convert.ToString(firstSelectedCell).Substring(42)); MessageBox.Show(s); } }
public void OnLoadShort() { var metrics = WorkWithExcel.EnumerateMetricsShort(Environment.CurrentDirectory + "/thrlist.xlsx").ToList(); MetricsDataGrid.ItemsSource = metrics; Style style = new Style(typeof(DataGridCell)); style.Setters.Add(new Setter(TextBlock.TextWrappingProperty, TextWrapping.Wrap)); MetricsDataGrid.CellStyle = style; for (int i = 2; i < MetricsDataGrid.Columns.Count; i++) { MetricsDataGrid.Columns[i].Visibility = Visibility.Collapsed; } }
public void OnLoad() { var metrics = WorkWithExcel.EnumerateMetrics(Environment.CurrentDirectory + "/thrlist.xlsx").ToList(); MetricsDataGrid.ItemsSource = metrics; Style style = new Style(typeof(DataGridCell)); style.Setters.Add(new Setter(TextBlock.TextWrappingProperty, TextWrapping.Wrap)); MetricsDataGrid.CellStyle = style; foreach (var column in MetricsDataGrid.Columns) { column.Visibility = Visibility.Visible; } }