Pages

Monday, June 25, 2018

WPF How to fill the datagrid with its propotionate columns

WPF How to fill the datagrid with its propotionate columns


Width="0.25*" in this way columns will be proportionately filled in the WPF datagrid
all the columns will have 25% of the area of the datagrid.
<DataGrid Name="dataGrid1" AutoGenerateColumns="False" ItemsSource="{Binding Values}">
   <DataGrid.Columns>
         <DataGridTextColumn  Header="Value1" Binding="{Binding Value1, Width="0.25*"/>
         <DataGridTextColumn  Header="Value2" Binding="{Binding Value2, Width="0.25*"/>
         <DataGridTextColumn  Header="Value3" Binding="{Binding Value3, Width="0.25*"/>
         <DataGridTextColumn  Header="Value4" Binding="{Binding Value4, Width="0.25*"/>
   </DataGrid.Columns>           
</DataGrid>


visit link download