public ResultSetDataGridTemplateSelector(IStatementValidator statementValidator, IConnectionAdapter connectionAdapter, ColumnHeader columnHeader) : this(statementValidator, connectionAdapter, $"[{columnHeader.ColumnIndex}]") { _columnHeader = columnHeader; _columnIndex = columnHeader.ColumnIndex; _hasReferenceConstraint = columnHeader.ParentReferenceDataSources?.Count > 0; }
protected ResultSetDataGridTemplateSelector(IStatementValidator statementValidator, IConnectionAdapter connectionAdapter, string bindingPath) { _statementValidator = statementValidator; _connectionAdapter = connectionAdapter; TextDataTemplate = CreateTextDataTemplate(bindingPath); HyperlinkDataTemplate = CreateHyperlinkDataTemplate(bindingPath, CellHyperlinkClickHandler); BarChartDataTemplate = CreateBarChartDataTemplate(bindingPath); }
public static void InitializeDataGridColumns(DataGrid dataGrid, IEnumerable<ColumnHeader> columnHeaders, IStatementValidator statementValidator, IConnectionAdapter connectionAdapter) { dataGrid.Columns.Clear(); foreach (var columnHeader in columnHeaders) { var columnTemplate = CreateDataGridTemplateColumn(columnHeader, statementValidator, connectionAdapter); dataGrid.Columns.Add(columnTemplate); } }
public SingleRowDataTemplateSelector(IStatementValidator statementValidator, IConnectionAdapter connectionAdapter) : base(statementValidator, connectionAdapter, ValueProperty) { var textBlockFactory = TextDataTemplate.VisualTree; textBlockFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left); textBlockFactory = HyperlinkDataTemplate.VisualTree; textBlockFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left); }
public SqlDocumentRepository(ISqlParser parser, IStatementValidator validator, IDatabaseModel databaseModel, string statementText = null) { _parser = parser ?? throw new ArgumentNullException(nameof(parser)); _validator = validator ?? throw new ArgumentNullException(nameof(validator)); _databaseModel = databaseModel; if (!String.IsNullOrEmpty(statementText)) { UpdateStatements(statementText); } }
public static DataGridColumn CreateDataGridTemplateColumn(ColumnHeader columnHeader, IStatementValidator statementValidator = null, IConnectionAdapter connectionAdapter = null) { var textBoxFactory = new FrameworkElementFactory(typeof(TextBox)); textBoxFactory.SetValue(TextBoxBase.IsReadOnlyProperty, true); textBoxFactory.SetValue(TextBoxBase.IsReadOnlyCaretVisibleProperty, true); var valueBinding = new Binding($"[{columnHeader.ColumnIndex}]") { Converter = CellValueConverter.Instance }; textBoxFactory.SetBinding(TextBox.TextProperty, valueBinding); var editingDataTemplate = new DataTemplate(typeof(DependencyObject)) { VisualTree = textBoxFactory }; var columnTemplate = new DataGridTemplateColumn { CellTemplateSelector = new ResultSetDataGridTemplateSelector(statementValidator, connectionAdapter, columnHeader), CellEditingTemplate = editingDataTemplate, ClipboardContentBinding = valueBinding }; ApplyColumnStyle(columnTemplate, columnHeader); return columnTemplate; }
public static DataGridColumn CreateDataGridTemplateColumn(ColumnHeader columnHeader, IStatementValidator statementValidator = null, IConnectionAdapter connectionAdapter = null) { var textBoxFactory = new FrameworkElementFactory(typeof(TextBox)); textBoxFactory.SetValue(TextBoxBase.IsReadOnlyProperty, true); textBoxFactory.SetValue(TextBoxBase.IsReadOnlyCaretVisibleProperty, true); var valueBinding = new Binding($"[{columnHeader.ColumnIndex}]") { Converter = CellValueConverter.Instance }; textBoxFactory.SetBinding(TextBox.TextProperty, valueBinding); var editingDataTemplate = new DataTemplate(typeof(DependencyObject)) { VisualTree = textBoxFactory }; var columnTemplate = new DataGridTemplateColumn { CellTemplateSelector = new ResultSetDataGridTemplateSelector(statementValidator, connectionAdapter, columnHeader), CellEditingTemplate = editingDataTemplate, ClipboardContentBinding = valueBinding }; ApplyColumnStyle(columnTemplate, columnHeader); return(columnTemplate); }
public static void InitializeDataGridColumns(DataGrid dataGrid, IEnumerable <ColumnHeader> columnHeaders, IStatementValidator statementValidator, IConnectionAdapter connectionAdapter) { dataGrid.Columns.Clear(); foreach (var columnHeader in columnHeaders) { var columnTemplate = CreateDataGridTemplateColumn(columnHeader, statementValidator, connectionAdapter); dataGrid.Columns.Add(columnTemplate); } }