绝对布局滚动视图不起作用

时间:2019-05-02 08:52:24

标签: c# xaml layout xamarin.forms

我具有绝对布局,因此无法更改布局,因为我修复了具有绝对布局的浮动动作按钮。该页面应该是可滚动的。但是其滚动功能不起作用。

我的XAML代码

<views:BaseContentPage.Content>
<controls:PullToRefreshLayout x:Name="PullToRefreshLayout" IsPullToRefreshEnabled="True" RefreshCommand="RefreshJournalHistoryPage">
    <AbsoluteLayout>
        <ScrollView>
        <StackLayout Spacing="0" BackgroundColor="{StaticResource DefaultBackgroundColor}">
            <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer Command="{Binding Source={x:Reference FlotingNavigationMenu},Path=TapCommand}"></TapGestureRecognizer>
            </StackLayout.GestureRecognizers>
            <StackLayout Orientation="Vertical" Padding="15,13,15,13" BackgroundColor="White" Spacing="-6">
                <Label Text="{Binding SelectedPatient.Name}" TextColor="{StaticResource DarkColor}" FontSize="{StaticResource FontSize18}" FontAttributes="Bold" LineBreakMode="TailTruncation"/>
                <Label Text="{Binding SelectedPatient.Details}" TextColor="{StaticResource QuateneryLightColor}" FontSize="{StaticResource FontSize14}" Margin="0,7,0,0"/>
            </StackLayout>
            <BoxView HeightRequest="0.4" Color="{StaticResource QuinaryLightColor}"/>
            <StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
                <StackLayout.Triggers>
                    <DataTrigger TargetType="StackLayout" Binding="{Binding IsDataLoaded}" Value="True">
                        <Setter Property="IsVisible" Value="False"/>
                    </DataTrigger>
                </StackLayout.Triggers>
                <Label Text="{Binding GetNoJournalString}"/>
            </StackLayout>
                <ListView x:Name="DocumentList" IsPullToRefreshEnabled="True" ItemsSource="{Binding Journals}" IsVisible="{Binding IsDataLoaded}" HasUnevenRows="True" BackgroundColor="{StaticResource LightAirColor}" SeparatorColor="{StaticResource QuinaryLightColor}" ItemSelected="ItemSelected" IsEnabled="{Binding Source={x:Reference FlotingNavigationMenu}, Path=PageEnable}"
                          Opacity="{Binding Source={x:Reference FlotingNavigationMenu},Path=Opacity}">
                <ListView.Behaviors>
                    <behaviors:InfiniteScroll LoadMoreCommand="{Binding LoadMore}" />
                </ListView.Behaviors>
                <ListView.Header>
                    <StackLayout BackgroundColor="{StaticResource SecondaryLightColor}" Padding="10">
                        <Frame x:Name="SortingPaneFrame" CornerRadius="8" BackgroundColor="{StaticResource LightAirColor}" HasShadow="False" Padding="10,2,10,4" HeightRequest="39">
                                <local:SortPaneListView x:Name="SortingList" ItemsSource="{Binding FilterTypesList}" ItemSelected="SortMethodTapped">
                                <ListView.Header>
                                    <local:CustomTableView HeightRequest="40">
                                        <TableSection>
                                            <ViewCell Tapped="OnSortingPaneTapped">
                                                <StackLayout Orientation="Vertical" Spacing="0" BackgroundColor="{StaticResource LightAirColor}">
                                                    <StackLayout Orientation="Horizontal" VerticalOptions="CenterAndExpand">
                                                        <Label Text="{x:Static Resource:AppResources.JounrnalHistoryViewPage_ArrangeBy}" TextColor="{StaticResource DarkColor}" FontSize="{StaticResource FontSize16}" HorizontalOptions="Start"/>
                                                        <Label x:Name="SortingPaneText" Text="{Binding GetFilterType}" TextColor="{StaticResource NavigationPrimary}" FontSize="{StaticResource FontSize16}" HorizontalOptions="EndAndExpand"/>
                                                    </StackLayout>
                                                </StackLayout>
                                            </ViewCell>
                                        </TableSection>
                                    </local:CustomTableView>
                                </ListView.Header>
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <StackLayout Orientation="Horizontal" BackgroundColor="{StaticResource LightAirColor}">
                                                <StackLayout Margin="0,0,15,0" WidthRequest="13" VerticalOptions="Center" Padding="4,0,-4,0">
                                                    <Image Source="{x:Static resources:ResourceIdentifiers.CheckIcon}" HeightRequest="13" IsVisible="{Binding Value}"></Image>
                                                </StackLayout>
                                                <Label Text="{Binding Name}" TextColor="{StaticResource NavigationPrimary}" FontSize="{StaticResource FontSize16}" HorizontalOptions="Start" VerticalOptions="CenterAndExpand"/>
                                            </StackLayout>
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                                <ListView.Footer>
                                    <StackLayout></StackLayout>
                                </ListView.Footer>
                            </local:SortPaneListView>
                        </Frame>
                    </StackLayout>
                </ListView.Header>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Horizontal" Padding="15,12,15,12">
                                <Image Margin="0,0,15,0" HeightRequest="20" VerticalOptions="StartAndExpand">
                                    <Image.Triggers>
                                        <DataTrigger TargetType="Image" Binding="{Binding Type}" Value="{x:Static enum:JournalType.Documents}">
                                            <Setter Property="Source" Value="{x:Static resources:ResourceIdentifiers.DocumentIcon}"></Setter>
                                        </DataTrigger>
                                        <DataTrigger TargetType="Image" Binding="{Binding Type}" Value="{x:Static enum:JournalType.LabResults}">
                                            <Setter Property="Source" Value="{x:Static resources:ResourceIdentifiers.LabResultIcon}"></Setter>
                                        </DataTrigger>
                                    </Image.Triggers>
                                </Image>
                                <StackLayout Orientation="Vertical" HorizontalOptions="Start" Spacing="0" Margin="0,-6,0,0">
                                    <Label Text="{Binding Title}" TextColor="{StaticResource DarkColor}" FontSize="{StaticResource FontSize17}"/>
                                    <Label Text="{Binding DateTimeFormated}" TextColor="{StaticResource QuateneryLightColor}" FontSize="{StaticResource FontSize13}"/>
                                    <Label Text="{Binding Author}" TextColor="{StaticResource DarkColor}" FontSize="{StaticResource FontSize13}"/>
                                </StackLayout>
                                <Image Style="{StaticResource ListRightArrow}"></Image>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.Footer>
                    <StackLayout HeightRequest="44">
                        <StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
                            <StackLayout.Triggers>
                                <DataTrigger TargetType="StackLayout" Binding="{Binding IsDataFullyLoaded}" Value="True">
                                    <Setter Property="IsVisible" Value="False"/>
                                </DataTrigger>
                            </StackLayout.Triggers>
                            <ActivityIndicator IsVisible="True" IsRunning="True" IsEnabled="True" VerticalOptions="Center" HorizontalOptions="Center" Color="Gray" HeightRequest="40"/>
                        </StackLayout>
                        <StackLayout IsVisible="{Binding IsDataFullyLoaded}">
                            <Label HeightRequest="44" BackgroundColor="{StaticResource DefaultBackgroundColor}"/>
                        </StackLayout>
                    </StackLayout>
                </ListView.Footer>
            </ListView>
        </StackLayout>
    </ScrollView>
        <views:FlotingNavigationMenu  AbsoluteLayout.LayoutBounds="1,1,-1,-1" AbsoluteLayout.LayoutFlags="PositionProportional"  x:Name="FlotingNavigationMenu"  ></views:FlotingNavigationMenu>
    </AbsoluteLayout>
</controls:PullToRefreshLayout>

我尝试了这些事情

 <ScrollView AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"> 

这不起作用,我也将Height设置为绝对布局,这也不起作用。如何使此页面可滚动而不更改布局。

0 个答案:

没有答案