Forum Xamarin.Forms

Xamarin Forms ListView isn't visible?

PfJuliPfJuli Member ✭✭
edited June 2020 in Xamarin.Forms

Hello,
at first thank you very much for your time. I created a ListView in Xamarin Forms and it worked perfectly. Today I tried to make a few changes and I also wanted to add an image. The image nearly covered the whole screen so I deleted this one. Now I have the problem, that my ListView is there, but it is so small that you only see a few yellow pixels in the center. The rest of the screen is white. Can anybody recognize an error here? Sorry for such questions! :/

        <ListView x:Name="ContactsList" ItemsSource="{Binding Source={x:Reference ContactsList}, Path=BindingContext.MyList}" IsVisible="True" MinimumHeightRequest="500" HasUnevenRows="True">
            <ListView.Header>
                <StackLayout Orientation="Horizontal">
                </StackLayout>
            </ListView.Header>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.ContextActions>
                        </ViewCell.ContextActions>
                        <StackLayout Orientation="Vertical">
                            <Label Text="{Binding Name}" FlowDirection="LeftToRight" FontAttributes="Bold" Margin="15,0,0,0" LineBreakMode="WordWrap" TextType="Text"></Label>
                            <Label Text="{Binding Address}" Margin="15,0,0,0"></Label>
                            <Button Text=" Clicked="Button_Clicked" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickedv" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickedo" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickeds" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickedi" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickedw" BackgroundColor="Yellow"></Button>
                            <Button Text="" Clicked="Button_Clickedf" BackgroundColor="Yellow"></Button>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
Tagged:

Best Answer

Answers

  • PfJuliPfJuli Member ✭✭

    @Jarvan said:

    Now I have the problem, that my ListView is there, but it is so small that you only see a few yellow pixels in the center.

    @PfJuli I tested a basic demo with the posted code, it works as shown. What is the 'a few yellow pixels'? Do you mean the selected color of the item? Please post more details about the issue.

    Thank you very much, now I had another closer look. I don't know how that happened, but when I deleted the Image, I may accidentally forget to delete another STackLayout, which is above the layout of the list view. This changed the scale of the whole listview, and so it was such small that you nearly didn't see it. Sorry for your time.

Sign In or Register to comment.