gridview没有以xamarin形式工作

时间:2016-12-28 20:59:27

标签: xamarin.forms xlabs

尝试使用xamarin表单中的gridview工作,但是当我的应用程序到达页面时,它会抛出IO异常。

这是我的代码:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
        xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms.Controls"
        x:Class="TamarianApp.ImagePage">
    <Grid>
        <StackLayout x:Name="mainView">
            <ScrollView>
                <StackLayout>
                    <BoxView Margin="0, -7, 0, 0" HorizontalOptions="FillAndExpand" HeightRequest="1" BackgroundColor="#f1f1f1"></BoxView>
                    <StackLayout x:Name="cameraMenuOption" Padding="10" Orientation="Horizontal" HorizontalOptions="Fill" >
                        <Label Margin="10, 2,0,0" HorizontalOptions="StartAndExpand">Camera</Label>
                        <Label x:Name="camera_label" Margin="10, 2,10,0" FontSize="14" TextColor="#c1c1c1" HorizontalOptions="End"></Label>
                        <Image HorizontalOptions="End" Source="icons/blue/next" WidthRequest="20"></Image>
                    </StackLayout>
                    <BoxView HorizontalOptions="FillAndExpand" HeightRequest="1" BackgroundColor="#f1f1f1"></BoxView>
                    <StackLayout x:Name="libraryMenuOption"  Padding="10" Orientation="Horizontal" HorizontalOptions="Fill" >
                        <Label Margin="10, 2,0,0" HorizontalOptions="StartAndExpand">Library</Label>
                        <Label x:Name="library_label" Margin="10, 2,10,0" FontSize="14" TextColor="#c1c1c1" HorizontalOptions="End"></Label>
                        <Image HorizontalOptions="End" Source="icons/blue/next" WidthRequest="20"></Image>
                    </StackLayout>
                </StackLayout>
            </ScrollView>
            <StackLayout BackgroundColor="#fafafa"  HorizontalOptions="FillAndExpand" >
                <BoxView HorizontalOptions="FillAndExpand"  HeightRequest="3" BackgroundColor="#f1f1f1"></BoxView>
            </StackLayout>
            <StackLayout>
                <controls:GridView x:Name="image_gallary">
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Image Source="{Binding filepath}"></Image>
                            </Grid>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </controls:GridView>
            </StackLayout>

有人可以帮助我。

0 个答案:

没有答案