DataGrid No Header & Access Template Content from code

Apr 21, 2009 at 3:51 PM

I have two questions:
1.I can't see the header text when running the following xaml code:

                    ItemsSource="{Binding Path=Emp.DefaultView}">
                    <dg:DataGridTemplateColumn x:Name="empno" IsReadOnly="True"  Header="No." Width="32" MinWidth="32" SortMemberPath="Empno" Visibility="Visible" CanUserReorder="False">
                                <TextBlock Text="{Binding Path=Empno}" TextAlignment="Right" />
                                <TextBox Text="{Binding Path=Empno}"/>

2. How can i access the Textbox located inside the CellEditingTemplate from code behind ?

Thanks in advance.

Rui G.

Jun 25, 2009 at 2:31 PM

I think I may be having the same problem - setting HeadersVisibility="Column" or HeadersVisibility="None" causes the data rows to overwrite the column headers (you can still see just the top few pixels of them). Even after setting ColumnHeaderHeight="200", the view is identical.

Interestingly, the headers are still there and may be re-ordered or sorted, and when re-ordering them they become temporarily fully visible, the rest of the datagrid shifting down to accomodate.

Any thoughts?

Jun 25, 2009 at 4:06 PM

This appears to have been caused by setting a style using <font size="2" color="#ff0000"><font size="2" color="#ff0000">


</font></font><font size="2" color="#ff0000">




If the style is set without this, HeadersVisibiliy="Column" works as expected.