SfListView

Hi,

I'm working with SfListView with the following structure.

<listview:SfListView>
     <listview:SfListView.ItemTemplate>
                                <DataTemplate>
                                         <Grid>
                                                  <Frame>
                                                       <StackLayout>
                                                            <Label>
                                                            <Label>
                                                        </StackLayout>
                                                  </Frame>
                                           </Grid>
                                </DataTemplate>
    </listview:SfListView.ItemTemplate>
</listview:SfListView>

And i've got the Entry tool upside this ListView. When i use normal ListView, i can see the EntryTextChanged property's movements. But when i use the SfListView,
i can't see the changes. Why? Is this about my inside of ListView or what?


    



11 Replies

JN Jayaleshwari N Syncfusion Team September 5, 2018 03:54 AM UTC

Hi Pinar,  
  
Thanks for using Syncfusion product.  
  
We have checked the reported query but we have not understand your requirement clearly. We have prepared the sample based on the information given in the incident. In our sample we have loaded the listview and filter the data based on the text typed in the entry.  
  
For your reference we have prepared the sample and you can download it from the below link.  
  
  
Please share more detail about the reported issue which would highly help us to analyze the query better and provide an appropriate solution.         
  
Regards,  
Jayaleshwari N 



PN Preethi Nesakkan Gnanadurai Syncfusion Team September 5, 2018 08:46 AM UTC

From: Pinar Can  
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated. 

Hi,  let me shared my codes: 
 
XAML SIDE: 
 
<Entry x:Name="entryTestControl" FontSize="Large" WidthRequest="80" Keyboard="Numeric TextChanged="EntryTestControlTextChanged"></Entry> 
 
<ListView x:Name="SfListView" RowHeight="100" HeightRequest="500" ItemTapped="SfListView_ItemTapped"> 
                            <ListView.ItemTemplate> 
                                <DataTemplate> 
 
                                  <Grid Margin="2" Padding="2"> 
 
                                        <Frame Margin="1" Padding="1" CornerRadius="10" HasShadow="True" BackgroundColor="DeepSkyBlue"> 
 
                                            <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Margin="5"> 
 
                                                <StackLayout VerticalOptions="Center"> 
                                                    <Label x:Name="labelTest1" Text="{Binding Test1}" FontSize="Medium" ></Label> 
                                                </StackLayout> 
 
                                                <StackLayout VerticalOptions="Start" HorizontalOptions="EndAndExpand"> 
                                                    <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"> 
 
                                                        <Label x:Name="labelTest2  " Text="Required" FontSize="Small"></Label> 
 
                                                        <Label x:Name="labelTest3" Text="Picked" FontSize="Small" HorizontalOptions="EndAndExpand"></Label> 
                                                    </StackLayout> 
 
                                                    <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"> 
 
                                                        <Label x:Name="labelTest4"  Text="{Binding Test4}" FontSize="Large"  
                                                               FontAttributes="Bold" TextColor="Black" HorizontalOptions="EndAndExpand"></Label> 
 
                                                        <Label x:Name="labelTest5" Text="{Binding Test5}"FontSize="Large"  
                                                                       FontAttributes="Bold" TextColor="Black" HorizontalOptions="EndAndExpand"></Label> 
 
                                                    </StackLayout> 
                                                </StackLayout> 
                                            </StackLayout> 
                                        </Frame> 
                                    </Grid> 
 
     </DataTemplate> 
                            </ListView.ItemTemplate> 
                        </ListView> 
 
 
And the CS SIDE: 
 
private async void EntryTestControlTextChanged (object sender, TextChangedEventArgs e) 
        { 
            try 
            { 
                double value; 
 
                if (Double.TryParse(e.NewTextValue, out value)) 
                { 
                    if (e.OldTextValue != e.NewTextValue) 
                    { 
                        if (myList != null)  
                        { 
                            myList.Quantity = value; 
                            SfListView.ItemsSource = null; 
                            SfListView.ItemsSource = myList; 
 
                            CalculateTotalCount(); 
 
                            if (total > 100) 
                            { 
                                await DisplayAlert("Warning", "Total exception!", "Ok"); 
 
                                myList.Quantity = selected.Quantity; 
                                SfListView.ItemsSource = null; 
                                SfListView.ItemsSource = myList; 
 
                                CalculateTotalCount(); 
 
                                entryTestControl.Text = selected.Quantity.ToString(); 
                            } 
                        } 
                    } 
                } 
                else 
                { 
                    if (myList != null) 
                    { 
                        myList.Quantity = 0; 
                        SfListView.ItemsSource = null; 
                        SfListView.ItemsSource = myList; 
 
                        CalculateTotalCount(); 
                    } 
                } 
            } 
            catch { } 
        } 
 
private void CalculateTotalCount() 
        { 
            try 
            { 
                total = 0; 
                for (int i = 0; i < myList.Count; i++) 
                    total += myList[i]. Quantity; 
 
                labeltotal.Text = total.ToString() + " unit"; 
            } 
            catch { } 
        } 
 
So, here is my question: When I use the normal ListView, I can see all of the result of my codes. But when I use the SfListView, there is only space.  
I checked and I know my changes are came but just doesn’t show. Why? Is this about SfListView structure or what? Bcs there no error,datas came BUT doesn’t show my page. 
Thanks, regards. 
 
Pınar CAN 



JN Jayaleshwari N Syncfusion Team September 6, 2018 03:34 PM UTC

Hi Pinar, 
 
We have checked the code snippet, code behind file and we have modified our sample to replicate the issue. We have found that when the item source is set to null then underlying collection also set to null, this is the issue. This is due to itemsource is a two way property in SfListView. We have checked the same with Xamarin listview it is in one way. You can achieve your requirement by set the mode as one way which resolves the reported issue. 
 
Code Snippet [Xaml]: 
<sync:SfListView x:Name="listView" ItemSize="100" HeightRequest="500" ItemsSource="{Binding myList,Mode=OneWay}"> 
   <sync:SfListView.ItemTemplate> 
       … 
       …  
   </sync:SfListView.ItemTemplate> 
</sync:SfListView> 
 
Please let us know if you require further assistance on this. 
 
Regards, 
Jayaleshwari N 



PN Preethi Nesakkan Gnanadurai Syncfusion Team September 7, 2018 07:02 AM UTC

From: Pinar Can  
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated. 

Hi Jayaleshwari N, 
 
Yess! It was my problem and this is absolutely solved my issue.  Well then I have one question more. 
How about “Mode” (ItemsSource="{Binding myList,Mode=OneWay}") ?? There are different modes.  
What modes should I choose for which situations? 
 
Thanks for your collaborations. 
 
Regards 
 
Pınar CAN 



PN Preethi Nesakkan Gnanadurai Syncfusion Team September 7, 2018 10:01 AM UTC

From: Pinar Can
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated.
 

Hi again, 
 
Sorry for update. This is not the solution for me. Still got errors and this time I can’t see nothing about my SfListView items. 
All datas are gone. But still working with basic ListView(the normal one).  So, what’s the problem ? 
 
Thanks for your collaborations. 
Regars, 
 
Pınar CAN


PN Preethi Nesakkan Gnanadurai Syncfusion Team September 10, 2018 06:18 AM UTC

From: Pinar Can 
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated.
 

Hi, 
Any updates or changes? 
 
Pınar CAN


JN Jayaleshwari N Syncfusion Team September 10, 2018 09:39 AM UTC

Hi Pinar,  
 
We have checked the reported issue again in our sample. We could notice that sample works when ItemsSource mode set as OneWay. Can you please explain your use case in which ItemsSource didn’t set. We have attached the sample that checked with one way, please find the sample from below.  
 
 
Can you please check with the above sample? whether you are facing similar issue in our sample. If no, we would request you to modify the sample or share the sample that replicates the issue which would highly helpful to us to analyze the issue better and update you an appropriate solution.    
 
Besides, we would like to know that Modes used in ItemsSource are  
 
OneWay : Indicates that binding should only propagates changes from source (usually the view model) to target(the bindable object). This is the default mode for most bindable property values. 
TwoWay : Indicates that binding should only propagates changes from source (usually the view model) to target(the bindable object) in both direction. 
Default : When used in Bindings the binding should be BindingProperty.DefaultBindingMode. Its default BindingMode is TwoWay. 
OneWayToSource : Indicates that binding should only propagates changes from target(the bindable object) to source (usually the view model). This is mainly used for read only bindable property values. 
  
Regards,  
Jayaleshwari N. 



PN Preethi Nesakkan Gnanadurai Syncfusion Team September 11, 2018 08:51 AM UTC

From: Pinar Can  
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated. 

Hi, 
Maybe it is about API level. Bcs some tools does not support some API Levels. (Also I try dfferent API levels which are, 
API 22, API 25 and API 27)However, I tried your sample and still listview doesn’t show me. I try all of the modes but it  
still doesn’t  show me. I send again my xaml side as “ForSync.txt”. 
 
I hope we can find the issue.  
Regards, 
 
Pınar CAN 





JN Jayaleshwari N Syncfusion Team September 12, 2018 11:35 AM UTC

Hi Pinar,  
 
For better follow up, we have created an incident under your direct- trac account.  Please follow the incident for further updates.   
 
Regards,  
Jayaleshwari N. 



PR Padmini Ramamurthy Syncfusion Team September 13, 2018 08:30 AM UTC

From: Pinar Can
Sent: Thursday, September 13, 2018 3:27 AM
To: Syncfusion Support <[email protected]>
Subject: YNT: Syncfusion support community forum 139619, SfListView, has been updated.
 

Hi, 
I following the incident from my account. I shared the incident in there.  
Can u please check? 
Regards, 
 
Pınar CAN 



JN Jayaleshwari N Syncfusion Team September 14, 2018 11:09 AM UTC

Hi Pinar, 
 
We have updated in incident. 
 
Regards, 
Jayaleshwari N. 


Loader.
Up arrow icon