Click here to Skip to main content
16,009,057 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In WPF, I am using simple grid as below

XML
<Grid>
    <DataGrid Name="grid1">
        <DataGrid.Columns>
            <DataGridTextColumn Header="Col1" Width="Auto"/>
        </DataGrid.Columns>
    </DataGrid>
</Grid>


It generates col1 as well as an extra collumn which is disabled. I dont know why it is generating an extra collumn I tried with AutoGeneratese.. Property but that is not a case here. Still it shows an extra collumn

Actually, it shows
----------------------
Col1 | ---------------
----------------------

It should show
----------------------
Col1------------------
----------------------

Thanks in advance :)
Posted

because the width of the column is not 100%, thaty a blank column is coming. try to make the width as 100%, then it will not display.

Try like that

<DataGridTextColumn Header="Col1" Binding="{Binding Path=Col1}"  Width="100*"></DataGridTextColumn>
 
Share this answer
 
Comments
Sanjay J Patolia 17-Jun-11 5:58am    
Hi it is working with minor changes. Thank you :)
nit_singh 17-Jun-11 6:00am    
welcome
Tarun.K.S 20-Jun-11 4:48am    
Aah I see, adding a * at the last column will fill upto the end. 5+
This[^] could help you.
 
Share this answer
 
Comments
Sanjay J Patolia 17-Jun-11 5:58am    
Hi it is working with minor changes. Thank you :)
Abhinav S 17-Jun-11 6:25am    
You are welcome.

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