Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Datagrid is bound to DataTable. But my Datagrid shows an extra empty column at the end. What is the solution to remove that extra column.
rudrik8 2-Jun-11 7:19am    
check that if u have add column from the design.
rc89994 2-Jun-11 7:38am    
no. i did not add column in design view.
Wayne Gaylard 2-Jun-11 8:49am    
Post your code where you fill the datatable, then someone might help you

1 solution

Set DataGrid's AutoGenerateColumns property to false. Hope this helps.

<pre lang="xml"><my:DataGrid  AutoGenerateColumns="False" Margin="36,23,45,112" Name="dataGrid1" Grid.Row="1" Background="White" VerticalGridLinesBrush="DarkGray" VerticalScrollBarVisibility="Hidden" xmlns:my=""  >
                <my:DataGridTemplateColumn Header="Icon" Width="50" IsReadOnly="True" >
                            <Image Source="{Binding Path=ImgPath}" Width="20" Height="20"/>
                <my:DataGridTextColumn Header="Position"  Binding="{Binding Path=PO}"   />
                <my:DataGridTextColumn Header=" Name" Binding="{Binding Path=NA}"  />
                <my:DataGridTextColumn Header="Gender" Binding="{Binding Path=GE}"  />
                <my:DataGridTextColumn Header="Status" Binding="{Binding Path=ST}"  />
                <my:DataGridTextColumn Header="Machine" Binding="{Binding Path=MA}"  />

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900