问题描述
使用 xamarin.forms.datagrid
控件时,我无法在 mac 中正确对齐网格行。
在下面找到我的 Xaml 代码
<dg:DataGrid ItemsSource="{Binding WorkingQueue,Mode=TwoWay}"
x:Name="dgWorkingQueue" SelectedItem="{Binding SelectedDataset}"
SelectionEnabled="True" RowHeight="50" HeaderHeight="50"
IsSortable="False"
BorderColor="White" HeaderBackground="#E0E6F8"
HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand"
ActiveRowColor="#00FFFFFF"
HeightRequest="420" WidthRequest="992"
ItemSelected="dgWorkingQueue_ItemSelected"
IsRefreshing="{Binding IsRefreshing}">
<dg:DataGrid.HeaderFontSize>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Tablet>15</OnIdiom.Tablet>
<OnIdiom.Phone>12</OnIdiom.Phone>
</OnIdiom>
</dg:DataGrid.HeaderFontSize>
<dg:DataGrid.NoDataView>
<Label Text="No records to show" FontSize="18" HorizontalOptions="Center" VerticalOptions="Center" Margin="0,50,0" />
</dg:DataGrid.NoDataView>
<dg:DataGrid.Columns>
<dg:DataGridColumn Title="Site ID" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding SiteID}" FontSize="14" IsReadOnly="True" HorizontalTextAlignment="Center"></Entry>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Dataset Name" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding DatasetName}" FontSize="14" IsReadOnly="True" HorizontalTextAlignment="Center" HorizontalOptions="FillAndExpand"></Entry>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Scan Date" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding ScanDate,StringFormat='{}{0:MM-dd-yyyy}'}" FontSize="14" IsReadOnly="True" HorizontalTextAlignment="Center"></Entry>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Asset Owner" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding Assetowner}" FontSize="14" IsReadOnly="True" HorizontalTextAlignment="Center"></Entry>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Project Name" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding ProjectName}" FontSize="14" IsReadOnly="True" HorizontalTextAlignment="Center"></Entry>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Action" Width="*">
<dg:DataGridColumn.CellTemplate >
<DataTemplate>
<ContentView>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Button Text="View" Style="{StaticResource RoundedButton}" FontFamily="{StaticResource FontTypeAwesomeSolid}" Command="{Binding Path= BindingContext.ViewDatasetCommand,Source={x:Reference dgWorkingQueue}}" CommandParameter="{Binding DatasetID}" />
<Button Text="Move" Style="{StaticResource RoundedButton}" FontFamily="{StaticResource FontTypeAwesomeSolid}" Command="{Binding Path= BindingContext.MovetoUploadQueueCommand,Source={x:Reference dgWorkingQueue}}" CommandParameter="{Binding DatasetID}" />
</StackLayout>
</ContentView>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
</dg:DataGrid.Columns>
<!--<dg:DataGrid.RowsBackgroundColorPalette>
<dg:PaletteCollection>
<Color>#F2F2F2</Color>
<Color>#FFFFFF</Color>
</dg:PaletteCollection>
</dg:DataGrid.RowsBackgroundColorPalette>-->
</dg:DataGrid>
截图
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)