tags:

views:

27

answers:

1

I have a wpf data Grid where I created twlo columns. But whenever I run the window the datagrid shows a extra column. I can't figure out why.? Below is my code

 <Custom:DataGrid
                             Background="White"
                             AlternatingRowBackground="#103D7EC5"       
                             RowHeaderWidth="20" 
                             SelectionMode="Single"  
                             SelectionUnit="FullRow" 
                             GridLinesVisibility="None"                          
                             MinRowHeight="30"    
                             EnableRowVirtualization="True"
                             EnableColumnVirtualization="True"
                             CanUserAddRows="False"
                             CanUserSortColumns="True"
                             AreRowDetailsFrozen="True"
                             RowDetailsVisibilityMode="Collapsed"
                             ItemsSource="{Binding CurrentEntity.RefDetails, Mode = TwoWay}" AutoGenerateColumns="False" Name="grdDoctor1" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxHeight="200">
                                <Custom:DataGrid.RowDetailsTemplate>
                                    <DataTemplate>
                                    </DataTemplate>
                                </Custom:DataGrid.RowDetailsTemplate>

                                <Custom:DataGrid.Columns>
                                <Custom:DataGridTextColumn Binding="{Binding DepId}" Width="100" IsReadOnly="True" Header="Id"/>
                                <Custom:DataGridTextColumn Binding="{Binding DepData}" Width="100" IsReadOnly="False" Header="Data"/>
                            </Custom:DataGrid.Columns>

                    </Custom:DataGrid>

Any suggestion why this is happening..?

alt text

+1  A: 

Does the extra column have data in it? Or is it just the Row Header (A little arrow that appears first in each row)? If it is the rowheader and you want to get rid of it then set HeadersVisibility to "Columns" or "None"

There is a nice image here which shows what an outline of the different parts of the grid.

Martin Harris
Sorry my mistake......
Johnny