Maui.DataGrid
Maui.DataGrid copied to clipboard
Header columns not aligning with data columns
Hi, I am just starting with this and have mimicked the sample code using columns from data in my application. I've noticed that (on Windows), the column headers do not align with the data, as shown in the attached screen shot.
Is there something I'm doing wrong in the setup of the grid. Below is the datagrid definition in the xaml file.
<dg:DataGrid x:Name="dataGrid" Grid.Row="1" RowTappedCommand="{Binding RowSelected}" SelectionMode="Single" ActiveRowColor="LightBlue"> dg:DataGrid.Columns <dg:DataGridColumn Title="Peak 1 (keV)" PropertyName="Peak1" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="Peak 2 (keV)" PropertyName="Peak2" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="eV/ch" PropertyName="EVch" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="Gain" PropertyName="Gain" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="Offset" PropertyName="Offset" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="P1 Calc (keV)" PropertyName="P1Calc" SortingEnabled="false"></dg:DataGridColumn> <dg:DataGridColumn Title="P2 Calc (keV)" PropertyName="P2Calc" SortingEnabled="false"></dg:DataGridColumn> </dg:DataGrid.Columns> </dg:DataGrid>
Thanks, Rich
If you're still having this problem, maybe you could create a sample repository showing the issue. I'm not able to reproduce this.
Make sure you are on .NET 8 with the latest version of both MAUI and this library, as there have been lots of bugs historically.
The only misaligned columns issue I'm aware of is if you try to set any column widths to Auto.