Hi,
I'm trying to extend the DataGridViewColumn's dialog with some properties. It works fine with the DataGrid control and the table styles, respectively column styles. With .NET 2.0 and DataGridViewColumn the extending component's "CanExtend" is still called with the DataGridViewColumn instances and returns "true", but no properties are being displayed in the edit columns dialog of the grid.
And now the question is: how can I extend the column properties using the IExtenderProvider-interface?
The extender component is shown below.
I'm trying to extend the DataGridViewColumn's dialog with some properties. It works fine with the DataGrid control and the table styles, respectively column styles. With .NET 2.0 and DataGridViewColumn the extending component's "CanExtend" is still called with the DataGridViewColumn instances and returns "true", but no properties are being displayed in the edit columns dialog of the grid.
And now the question is: how can I extend the column properties using the IExtenderProvider-interface?
The extender component is shown below.
using System;using System.ComponentModel;using System.Collections.Generic;using System.Windows.Forms;using System.Diagnostics;using System.Text;namespace UA.DataBinding { [ ProvideProperty("ColumnParser", typeof(DataGridViewColumn))][ ProvideProperty("ColumnFormatter", typeof(DataGridViewColumn))]publicclassUAGridFormatter : Component, IExtenderProvider, ISupportInitialize{public UAGridFormatter(){ InitializeComponent(); } public UAGridFormatter(IContainer container){ container.Add( this);InitializeComponent(); } [ Category( "Layout")][ DefaultValue(null)]publicIParser GetColumnParser(DataGridViewColumn column){ returnnull;} [ Category( "Layout")][ DefaultValue(null)]publicvoid SetColumnParser(DataGridViewColumn column, IParser parser){ } [ Category("Layout")][ DefaultValue(null)]publicIFormatter GetColumnFormatter(DataGridViewColumn column){ returnnull;} [ Category( "Layout")][ DefaultValue(null)]publicvoid SetColumnFormatter(DataGridViewColumn column, IFormatter formatter){ } publicbool CanExtend(object extendee) { return(extendee isDataGridViewColumn);}
#region ISupportInitialize Memberpublicvoid BeginInit(){ } publicvoid EndInit(){ if (!DesignMode){ } } #endregion private System.ComponentModel.IContainer components = null; ///<summary> /// Clean up any resources being used. ///</summary> ///<param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protectedoverridevoid Dispose(bool disposing){ if (disposing && (components != null)){ components.Dispose(); } base.Dispose(disposing);} #region Component Designer generated code///<summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor.///</summary>privatevoid InitializeComponent(){ components = new System.ComponentModel.Container();} #endregion}} |