示例#1
0
 public ResultSetDataGridTemplateSelector(IStatementValidator statementValidator, IConnectionAdapter connectionAdapter, ColumnHeader columnHeader)
     : this(statementValidator, connectionAdapter, $"[{columnHeader.ColumnIndex}]")
 {
     _columnHeader           = columnHeader;
     _columnIndex            = columnHeader.ColumnIndex;
     _hasReferenceConstraint = columnHeader.ParentReferenceDataSources?.Count > 0;
 }
示例#2
0
 protected ResultSetDataGridTemplateSelector(IStatementValidator statementValidator, IConnectionAdapter connectionAdapter, string bindingPath)
 {
     _statementValidator   = statementValidator;
     _connectionAdapter    = connectionAdapter;
     TextDataTemplate      = CreateTextDataTemplate(bindingPath);
     HyperlinkDataTemplate = CreateHyperlinkDataTemplate(bindingPath, CellHyperlinkClickHandler);
     BarChartDataTemplate  = CreateBarChartDataTemplate(bindingPath);
 }
示例#3
0
		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);
			}
		}
示例#4
0
        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);
        }
示例#5
0
        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);
            }
        }
示例#6
0
		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;
		}
示例#7
0
        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);
        }
示例#8
0
        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);
            }
        }