Register GridColumnStyle in DataGrid/TableStyles/GridColumnStyles designer?

  • Thread starter Thread starter alex n
  • Start date Start date
A

alex n

this one already has
'add' button with drop-down menu
with
-datagridtextboxcolumn
-datagridboolcolumn

how could i put my own cols there?
 
Check out following article:
http://www.microsoft.com/belux/nl/msdn/community/columns/jtielens/datagrid.mspx
Extending the DataGrid using CodeDom

Building only the DataGridObjectColumn is enough to use the column, but
there is no desing-time support for it. So if you wanted to use the column
at this point, you'd have to write the code to build a TableStyle manually
because you can't select the DataGridObjectColumn in the TableStyle
designer. Our goal was to provide full design-time support, as showed in
figure 4.





Why doesn't the DataGridObjectColumn show in the
DataGridColumnStyleCollection Editor yet? The values that are listed in the
dropdown list are determined by the return value of the CreateNewItemTypes
function of the DataGridColumnStylesCollectionEditor class. So to alter this
behavior, we need to implement our own DataGridColumnStylesCollectionEditor
class. But to be able to use this class we need to have a custom
DataGridTableStyle class that tells Visual Studio to use our editor. We're
not there yet, because we will have to build our own
TableStylesCollectionEditor class too, because we want to use our
DataGridTableStyle, and of course if we want to use our
TableStylesCollectionEditor we need a custom DataGrid. Quite a lot classes
to build, just to get an extra item in the DataGridColumnStyleCollection
Edtior...
 
Hi Jan,

Cool idea indeed.
I see only one drawback in this approach - you can not unload assemblies.
As a workaround you might compile them in another AppDomain.
 
Thx Miha, I was playing with the idea too. But usually you only have a few
predefined expressions you want to evaluate, so these few assemblies won't
cause any problems (they are cached). I agree, it's a little bit "dirty"...
:-)
 
Hi Jan,


Jan Tielens said:
Thx Miha, I was playing with the idea too. But usually you only have a few
predefined expressions you want to evaluate, so these few assemblies won't
cause any problems (they are cached). I agree, it's a little bit "dirty"...
:-)

Probably true, yes :)
 
Back
Top