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

Problem with SfNumericTextBox template binding

I want to use SfNumericTextBox to input data in ListView. The problem is when I change value in one SfNumericTextBox  some other SfNumericTextBox  in a certain row changes. I don't know if is the limitation of Listview of some other reasons.
The following are the the samples of my code:

 <syncfusion:SfListView x:Name="listView" AllowGroupExpandCollapse="True"
                                    ItemSize="50" ItemSpacing="0,2,0,0" AutoFitMode="Height" SelectionBackgroundColor="#DDDDDD"
                                   >
              
         
                <syncfusion:SfListView.ItemTemplate>
                    <DataTemplate>
                        <StackLayout Padding="5" BackgroundColor="#FFFFFF" >
                           
                                <StackLayout  Orientation="Horizontal"    >
                                    <Label    Text="{Binding AccountNO}"    FontSize="12" FontAttributes="Bold" />
                                    <Label    Text="{Binding Shughuli}"     FontSize="12" />
                                </StackLayout>
                                
                           
                            
                            <StackLayout     Orientation="Horizontal" HorizontalOptions="EndAndExpand"  >
                                <Label HorizontalTextAlignment="End"   Text="Balance: "    FontSize="10" />
                                <Label HorizontalTextAlignment="End"    Text="{Binding Kiasi, StringFormat=' {0:N}'}" FontAttributes="Bold"    FontSize="10" />
                                <Label HorizontalTextAlignment="End"   Text="{Binding Aina}"   FontSize="10" TextColor="Red" />

                            </StackLayout>
                            <StackLayout     Orientation="Horizontal" HorizontalOptions="EndAndExpand"  >
                                <inputLayout:SfTextInputLayout Hint="Amount" 
                 ContainerType="Outlined"  ContainerBackgroundColor="#FFFFFF"  HorizontalOptions="EndAndExpand" WidthRequest="200">

                                    <numerictextbox:SfNumericTextBox x:Name="{Binding ID}"  AutomationId="{Binding ID}"  FontSize="12" FormatString="Tsh" EnableGroupSeparator = "true" HorizontalOptions="EndAndExpand" WidthRequest="200" HeightRequest="50"/>

                                </inputLayout:SfTextInputLayout>
                            </StackLayout>
                            </StackLayout>
                    </DataTemplate>
                </syncfusion:SfListView.ItemTemplate>
            </syncfusion:SfListView> 

C# Model Code

 public class RootFundRequest
    {
        public List<RootFundRequestModel> d { get; set; }
    }

    public class RootFundRequestModel
    {
        public string ID { get; set; }
        public string AccountNO { get; set; }
        public string Description{ get; set; }
        public float Amount{ get; set; }
        public string Type{ get; set; }
    }

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team July 22, 2019 12:17 PM UTC

Hi Annael, 
  
Thanks for using Syncfusion product. 
  
We could able to reproduce the reported issue while using NumerixTextBox inside ListView’s ItemTemplate in our sample. We would like to inform you that reported occurs because of ListView’s implementation behavior. We have implemented SfListView based on Virtualization architecture so ListviewItem will be re-using while scrolling the list which cause reported issue in NumericTextBox. To overcome the reported behavior, you can bind the NumericTextBox value like below. We have attached the sample and code snippet for your reference, please find them from below. 
  
  
  
<syncfusion:SfListView x:Name="listView" AutoFitMode="Height"          
                       ItemsSource="{Binding contactsinfo}"> 
      <syncfusion:SfListView.ItemTemplate > 
         <DataTemplate> 
                <Grid x:Name="grid" RowSpacing="0"> 
                      <syncfusionNumeric:SfNumericTextBox x:Name="numericTextBox" Grid.Row="1"Grid.Column="0" Value="{Binding ContactNumber}" /> 
                 </Grid> 
          </DataTemplate> 
      </syncfusion:SfListView.ItemTemplate> 
</syncfusion:SfListView> 
  
  
   
Please let us know whether the above solution resolves the issue at your end. 
  
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon