How to set Resources for DataGridTemplateColumn

Jun 9, 2009 at 9:34 AM

I implement a Customize Control of DataGridTemplateColumn and let it derive from DataGridTemplateColumn, but how to set its Resources, since I have one defined ResourceDictonary.

Dose anyone know the answer?Thanks very much! Dan

Coordinator
Jun 9, 2009 at 9:44 PM

Hi Dan,

You should be able to set the Resources on the DataTemplate which you put inside the CellTemplate of your DataGridTemplateColumn, like so:

             <DataGrid>
                <DataGrid.Columns>
                    <DataGridTemplateColumn>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate Resources="...">
                                ...
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid> 

Is that what you were looking for?

Thanks,
Samantha

Jun 16, 2009 at 11:48 AM
Edited Jun 16, 2009 at 11:49 AM

hi

If i want sorting facility on this "DataGridTemplateColumn" then How can i do it Because i tried it but Sorting is not Working on this......

Coordinator
Jun 16, 2009 at 10:16 PM

Hi Yagnesh2879,

http://blogs.msdn.com/jgoldb/archive/2008/08/26/improving-microsoft-datagrid-ctp-sorting-performance.aspx

This article will show you how to setup your Custom sorting for a DatgridTemplateColumn.

Thanks.