We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

LISTVIEW no loading in content view

Hi team , my horizontal list view work everthing in content page 

but is didn't load in content view , need click on the list view , the item only appear




3 Replies

AN ANSON October 17, 2022 09:04 PM

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             x:Class="ATAS.NewPage1"

             xmlns:listView="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"


             Title="NewPage1">

    <ContentPage.Content>

        <Grid>

            <Grid.RowDefinitions>

                <RowDefinition Height="AUTO"/>

                <RowDefinition Height="AUTO"/>


            </Grid.RowDefinitions>

            <StackLayout Grid.Row="0" BackgroundColor="Red">

            <Grid>

                <listView:SfListView x:Name="ItemSizelstViewData"

                                    HeightRequest="100"

                                     ItemSize="150"

                                     ItemSpacing="10"

                                     MinimumWidthRequest="100"

                                     MaximumWidthRequest="400"

                                     Orientation="Horizontal"

                                     SelectionMode="Single">



                    <!--#region Listing-->

                    <listView:SfListView.ItemTemplate>

                        <DataTemplate>

                            <ViewCell>

                                <Frame Padding="0" BackgroundColor="White">


                                    <StackLayout BackgroundColor="#3cb371">

                                        <Label Text="{Binding SizeDescription}" TextColor="White"

                                                            FontSize="28" FontAttributes="Bold"

                                                            HorizontalTextAlignment="Center"

                                                            VerticalTextAlignment="Center"

                                                            VerticalOptions="CenterAndExpand"/>

                                    </StackLayout>

                                </Frame>

                            </ViewCell>

                        </DataTemplate>

                    </listView:SfListView.ItemTemplate>

                    <!--#endregion-->

                </listView:SfListView>

            </Grid>


        </StackLayout>

            <StackLayout Grid.Row="1" BackgroundColor="Red">

                <Grid>

                    <listView:SfListView x:Name=" ModifierlstViewData"

                                    HeightRequest="100"

                                     ItemSize="150"

                                     ItemSpacing="10"


                                     Orientation="Horizontal"

                                     SelectionMode="Single">



                        <!--#region Listing-->

                        <listView:SfListView.ItemTemplate>

                            <DataTemplate>

                                <ViewCell>

                                    <Frame Padding="0" BackgroundColor="White">


                                        <StackLayout BackgroundColor="#3cb371">

                                            <Label Text="{Binding ModifierDescription}" TextColor="White"

                                                            FontSize="28" FontAttributes="Bold"

                                                            HorizontalTextAlignment="Center"

                                                            VerticalTextAlignment="Center"

                                                            VerticalOptions="CenterAndExpand"/>

                                        </StackLayout>

                                    </Frame>

                                </ViewCell>

                            </DataTemplate>

                        </listView:SfListView.ItemTemplate>

                        <!--#endregion-->

                    </listView:SfListView>

                </Grid>


            </StackLayout>


        </Grid>

    </ContentPage.Content>

</ContentPage>



AN ANSON October 17, 2022 09:04 PM

using ATAS.Models;

using CommunityToolkit.Maui.Views;

using Microsoft.Maui.Controls;


namespace ATAS.Views;


public partial class POS : ContentPage

{

    public List<POS_ITEM_MODEL> positemModel { get; set; }

    public List<StockMaster_tmp> stockmaster_tmp { get; set; }

    public List<POS_MenuItem> pOS_MenuItems { get; set; }

    public List<Item_Size_Model> item_Size_Models { get; set; }

    public List<Modifier_Model> modifier_Models { get; set; }



    public POS()

{

InitializeComponent();


        modifier_Models = new List<Modifier_Model>();

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "HOT" });

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "COLD" });

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "HOT" });

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "COLD" });

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "HOT" });

        modifier_Models.Add(new Modifier_Model() { ModifierDescription = "COLD" });


        ModifierlstViewData.ItemsSource = modifier_Models;


        item_Size_Models = new List<Item_Size_Model>();

        item_Size_Models.Add(new Item_Size_Model() { SizeDescription = "300ML" });

        item_Size_Models.Add(new Item_Size_Model() { SizeDescription = "300ML" });




        ItemSizelstViewData.ItemsSource = item_Size_Models;


        //POS ITEM MENU LIST

        pOS_MenuItems = new List<POS_MenuItem>();

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        pOS_MenuItems.Add(new POS_MenuItem() { MenuDescription = "Beverage", MenuGroup = "Beverage" });

        PosMenuItemListView.ItemsSource=pOS_MenuItems;


        //POS TRANSACTION

        positemModel = new List<POS_ITEM_MODEL>();

        positemModel.Add(new POS_ITEM_MODEL() { Description = "COFFEE", Qty = "1", UOM = "UNIT", IMAGE = "1500" });

        POS_Item_DataGrid.ItemsSource= positemModel;


        //STOCK MASTER LIST

        stockmaster_tmp = new List<StockMaster_tmp>();

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "WANTAN MEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });

        stockmaster_tmp.Add(new StockMaster_tmp() { StockDescription = "COFFEE", StockGroup = "1", IMAGE = "coffee.png", ImageURl = "1500" });


        StockMasterListView.ItemsSource= stockmaster_tmp;

    }

    private void OnFilterTextChanged(object sender, TextChangedEventArgs e)

    {

        searchBar = (sender as SearchBar);

        if (StockMasterListView.DataSource != null)

        {


            this.StockMasterListView.DataSource.Filter = FilterStockMater;

            this.StockMasterListView.DataSource.RefreshFilter();

        }

    }


    private bool FilterStockMater(object obj)

    {

        if (searchBar == null || searchBar.Text == null)

            return true;


        var listItemName = obj as StockMaster_tmp;

        if (listItemName.StockDescription.ToLower().Contains(searchBar.Text.ToLower())

             || listItemName.StockGroup.ToLower().Contains(searchBar.Text.ToLower()))


            return true;

        else

            return false;



    }


    private void StockMasterListView_ItemTapped(object sender, Syncfusion.Maui.ListView.ItemTappedEventArgs e)

    {

        // this.ShowPopup(new VariantPopUp());

        popupLoginView.IsVisible = true;

    }


    private void Button_Clicked(object sender, EventArgs e)

    {

        popupLoginView.IsVisible = false;

    }

}



SY Suthi Yuvaraj Syncfusion Team October 18, 2022 04:38 AM

Hi Anson,


We have checked the reported query “ListView no loading in content view”, issue is not replicated at our end, We have created a sample based on the provided code snippet , SfListView inside contentView is working fine.We have attached the output screenshot and tested sample and scenario for your reference


Also We suspect that the handler for SfListView[ConfigureSyncfusionListView()] was not register in the MauiProgram.cs class in the sample. Please refer UG link for handler registration and let us know if your still facing the issue

UG link: https://help.syncfusion.com/maui/listview/getting-started#register-the-handler


If yes, Please share the below details or modify the sample to replicate the issue which will be more helpful for us to find the solution as soon as possible.

  1. Code snippet related to SfListView inside the ContentView and related customization
  2. Illustration video to reproduce the issue
  3. Syncfusion ListView nuget version and Visual Studio version


Regards,

Suthi Yuvaraj.


Attachment: Default_d2c83f1.zip

Loader.
Live Chat Icon For mobile
Up arrow icon