Xaml 栅格行间距在PancakeView中似乎不起作用
我有以下XAML文件:Xaml 栅格行间距在PancakeView中似乎不起作用,xaml,xamarin,xamarin.forms,Xaml,Xamarin,Xamarin.forms,我有以下XAML文件: <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:yumm
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
x:Class="BottomSlider.TestView">
<yummy:PancakeView BackgroundColor="White"
Border="{yummy:BorderMarkup Color=Red, Thickness='1'} "
VerticalOptions="EndAndExpand"
x:Name="MyDraggableView"
CornerRadius="60,60,0,0"
HorizontalOptions="FillAndExpand"
HeightRequest="600" >
<Grid>
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
</Grid>
<BoxView BackgroundColor="Red" Grid.Row="0"/>
<BoxView BackgroundColor="YellowGreen" Grid.Row="1"/>
<BoxView BackgroundColor="Aqua" Grid.Row="2"/>
<BoxView BackgroundColor="Bisque" Grid.Row="3"/>
<BoxView BackgroundColor="BlanchedAlmond" Grid.Row="4"/>
<BoxView BackgroundColor="Blue" Grid.Row="5"/>
<BoxView BackgroundColor="DimGray" Grid.Row="6"/>
<BoxView BackgroundColor= "HotPink" Grid.Row="7"/>
<BoxView BackgroundColor="Gold" Grid.Row="8"/>
</Grid>
</yummy:PancakeView>
</ContentPage>
通过设置rowspacting=“0”
这似乎不起作用。
下面的图像是xaml在模拟器上运行后的样子
您正在定义两个嵌套的
网格,但仅在内部网格中设置行间距=“0”
,该网格为空且不包含您的Boxview
。要回答您的问题,请只保留一个网格
:
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<BoxView BackgroundColor="Red" Grid.Row="0"/>
<BoxView BackgroundColor="YellowGreen" Grid.Row="1"/>
<BoxView BackgroundColor="Aqua" Grid.Row="2"/>
<BoxView BackgroundColor="Bisque" Grid.Row="3"/>
<BoxView BackgroundColor="BlanchedAlmond" Grid.Row="4"/>
<BoxView BackgroundColor="Blue" Grid.Row="5"/>
<BoxView BackgroundColor="DimGray" Grid.Row="6"/>
<BoxView BackgroundColor= "HotPink" Grid.Row="7"/>
<BoxView BackgroundColor="Gold" Grid.Row="8"/>
</Grid>
据我所知,现在xamarin forms 4.8版的框架中提供了pancake中的任何功能,因此请在框架内尝试一次。您可以向我解释,从pancake视图中删除左边框和右边框的白色间距,如上图所示。我已尝试设置Margin=“0,0,0,0”,但没有luck@George在我的模拟器中,没有与您共享的代码完全相同的空白边距。对不起,我不能复制。您是否正在更改代码中的任何内容?
<Grid RowSpacing="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
</Grid>
....