Click here to Skip to main content
15,894,720 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows login Pin
sharathgowda27-Jan-05 0:58
sharathgowda27-Jan-05 0:58 
GeneralRe: Windows login Pin
Dave Kreskowiak27-Jan-05 4:18
mveDave Kreskowiak27-Jan-05 4:18 
GeneralUpdating a database from a complex DataSet Pin
Luis Alonso Ramos26-Jan-05 18:11
Luis Alonso Ramos26-Jan-05 18:11 
Generalusing wsdl.exe to generate webservice server and proxy Pin
rana7426-Jan-05 16:36
rana7426-Jan-05 16:36 
Generalaccessing variables Pin
John L. DeVito26-Jan-05 14:05
professionalJohn L. DeVito26-Jan-05 14:05 
GeneralRe: accessing variables Pin
Heath Stewart26-Jan-05 14:22
protectorHeath Stewart26-Jan-05 14:22 
GeneralCustom Column Style (Windows Forms) Pin
epinaud26-Jan-05 10:14
epinaud26-Jan-05 10:14 
GeneralRe: Custom Column Style (Windows Forms) Pin
Heath Stewart26-Jan-05 14:35
protectorHeath Stewart26-Jan-05 14:35 
For information like this you need to know how the collection editor works to know if you can even do what you want. Use ildasm.exe from the Framework SDK (installed by default with VS.NET or downloadable from http://msdn.microsoft.com/netframework[^]) to read the IL (Intermediate Language, like a high-level assembler) or a tool like .NET Reflector[^] to decompile the code.

Look at the DataGridTableStyle.GridColumnStyles property to find that there's no EditorAttribute, so look at the property type - GridColumnStylesCollection, to find that it references the editor type System.Windows.Forms.Design.DataGridColumnCollectionEditor, System.Design. If you look at that class from the System.Design assembly you'll see that it's internal and you can't access it. It also doesn't expose any functionality that you can use statically through reflection.

The next best option is to sub-class DataGridTableStyle and override the GridColumnStyles to return your own derivative of the GridColumnStylesCollection class, attributed with your own editor class that derives from the same class that the current collection extends: the CollectionEditor class, which is public and defined under the System.ComponentModel.Design namespace.

Override the CreateNewTypes() method like so:
public class MyGridColumnStylesCollectionEditor : CollectionEditor
{
  protected override Type[] CreateNewTypes()
  {
    return new Type[]
    {
      typeof(DataGridTextBoxColumn),
      typeof(DataGridBoolColumn),
      typeof(MyDataGridCustomColumn)
    };
  }
}
You can do this a couple of other ways like implementing ICustomTypeDescriptor but it would be quite a bit more difficult.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralProgramming crystal reportsss Pin
primomak26-Jan-05 9:39
primomak26-Jan-05 9:39 
GeneralAdding assemblies to the GAC Pin
thepersonof26-Jan-05 8:27
thepersonof26-Jan-05 8:27 
GeneralRe: Adding assemblies to the GAC Pin
Nick Parker26-Jan-05 10:15
protectorNick Parker26-Jan-05 10:15 
GeneralGeneral .Net question Pin
Yaakov Davis26-Jan-05 8:11
Yaakov Davis26-Jan-05 8:11 
GeneralRe: General .Net question Pin
Heath Stewart26-Jan-05 14:44
protectorHeath Stewart26-Jan-05 14:44 
GeneralBinding DB to Controls Pin
Eyal Carmi26-Jan-05 3:00
Eyal Carmi26-Jan-05 3:00 
GeneralRe: Binding DB to Controls Pin
Heath Stewart26-Jan-05 14:50
protectorHeath Stewart26-Jan-05 14:50 
GeneralProgramming crystal reportsss Pin
primomak26-Jan-05 2:03
primomak26-Jan-05 2:03 
GeneralSystem wainning sound Pin
jzb26-Jan-05 1:35
jzb26-Jan-05 1:35 
GeneralRe: System wainning sound Pin
jzb26-Jan-05 17:51
jzb26-Jan-05 17:51 
Questionhow to programe winform to surppoort multiLanguage ? Pin
Fire.Rolland.Han26-Jan-05 0:24
Fire.Rolland.Han26-Jan-05 0:24 
AnswerRe: how to programe winform to surppoort multiLanguage ? Pin
Richard Schneider26-Jan-05 0:58
Richard Schneider26-Jan-05 0:58 
GeneralRe: how to programe winform to surppoort multiLanguage ? Pin
Fire.Rolland.Han26-Jan-05 1:24
Fire.Rolland.Han26-Jan-05 1:24 
GeneralRe: how to programe winform to surppoort multiLanguage ? Pin
Richard Schneider26-Jan-05 1:41
Richard Schneider26-Jan-05 1:41 
GeneralRe: how to programe winform to surppoort multiLanguage ? Pin
Heath Stewart26-Jan-05 14:40
protectorHeath Stewart26-Jan-05 14:40 
GeneralAnother DllImport question Pin
bluish26-Jan-05 0:12
bluish26-Jan-05 0:12 
GeneralRe: Another DllImport question Pin
Corinna John26-Jan-05 1:29
Corinna John26-Jan-05 1:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.