欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

WPF DataGrid 去掉空白列

程序员文章站 2022-07-14 08:40:46
...

设置最后一列的Width="*"

<DataGrid Name="dgBuild" ItemsSource="{Binding}" HorizontalScrollBarVisibility="Hidden"  AutoGenerateColumns="False"  CanUserReorderColumns="False" HeadersVisibility="None"  GridLinesVisibility="All" HorizontalGridLinesBrush="#000" BorderThickness="1" IsReadOnly="True" >
                
                <DataGrid.Columns  >
                    
                    <DataGridTextColumn  Binding="{Binding ItemName}" />
                    <DataGridTextColumn Binding="{Binding Class}"/>
                    **<DataGridTextColumn Width="*" Binding="{Binding Data}"/>**
                    
                    
                </DataGrid.Columns>
                
            </DataGrid>
         
相关标签: WPF wpf datagrid