gridview not working in xamarin forms

361 views Asked by At

Trying to get gridview in xamarin forms to work, but when my app reaches the page it throws an IO exception.

This is my code:

<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>

Can someone help me.

0

There are 0 answers