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

Object binding in Android

I have a listview with data.When clicking on an item, the popup will display details.On UWP works perfectly.On Android, the popup will show no data.


    <ContentPage.Resources>
        <ResourceDictionary>

           <DataTemplate x:Key="PopupDateTemplate">
                <ViewCell>
                    <StackLayout >
                               <!-- ... -->
                                <Label Text="{Binding UserName}"  />
                               <!-- ... -->
                    </StackLayout>
                </ViewCell>
            </DataTemplate>

        </ResourceDictionary>
    </ContentPage.Resources>

        <popuplayout:SfPopupLayout x:Name="PopupDate"  >
            <popuplayout:SfPopupLayout.PopupView >
                <popuplayout:PopupView ShowFooter="False" ShowHeader="False"  HeightRequest="350" WidthRequest="450"/>
            </popuplayout:SfPopupLayout.PopupView>
        </popuplayout:SfPopupLayout>

         <listView:SfListView x:Name="ListViewDate"
                              ItemsSource="{Binding Appointments}"
                              ItemTapped="ListViewDate_OnItemTapped">
          <!-- ... -->

private void ListViewDate_OnItemTapped(object sender, ItemTappedEventArgs e)
{
var appointment = e.ItemData as Appointment;
if (appointment != null)
{
   PopupDate.BindingContext = null;
   PopupDate.PopupView.ContentTemplate = null;
   PopupDate.BindingContext = appointment;
   PopupDate.PopupView.ContentTemplate = (DataTemplate)Resources["PopupDateTemplate"];
   PopupDate.Show();
}
}



4 Replies

PK Pradeep Kumar Balakrishnan Syncfusion Team March 14, 2019 01:33 PM UTC

Hi Eugen , 
 
Thank you using Syncfusion controls. 
 
Currently, we are checking on the mentioned issue with “Items in popview is rendered in UWP but not working in Android “. We will validate and update you the details in two business days (March 18, 2019). We appreciate your patience until then. 
 
Regards, 
Pradeep Kumar B 



PK Pradeep Kumar Balakrishnan Syncfusion Team March 19, 2019 06:21 PM UTC

Hi Eugen Dolgi, 
 
Thank you for your patience. 
 
We have checked the reported issue “Popup binding is not updated properly in Android but same code is works in UWP”. we can able to reproduce the reported issue on our side. We will validate the issue and provide you further details in one business days March 20,2019. We appreciate your patience until then. 
 
Regards, 
Pradeep Kumar B 



SS Sivaraman Sivagurunathan Syncfusion Team March 20, 2019 04:02 PM UTC

Hi Eugen, 
  
We could able to reproduce the issue “Items in popview is rendered in UWP but not working in Android “. The binding context are updated in Forms.Android as similar to Forms.UWP, but if ContentTemplate is set from the resources of the page the values are not rendered. We are validating the issue and will update you the further details on 21st march 2019. 
The values can be updated if ContentTemplate has been set in the OnItemTapped event. Refer the below code for reference. 
  
  
private void ListViewDate_OnItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) 
    var appointment = e.ItemData as DetailsContactInfo; 
    if (appointment != null) 
    { 
        PopupDate.BindingContext = null; 
        PopupDate.PopupView.ContentTemplate = null; 
        PopupDate.BindingContext = appointment; 
  
        var customTemplate = new DataTemplate(() => 
        { 
            var contactName = new Label(); 
            contactName.SetBinding(Label.TextProperty, new Binding("ContactName", BindingMode.Default, null, null, null, appointment)); 
  
            var contactNumber = new Label(); 
            contactNumber.SetBinding(Label.TextProperty, new Binding("ContactNumber", BindingMode.Default, null, null, null, appointment)); 
  
            var stack = new StackLayout(); 
            stack.Children.Add(contactName); 
            stack.Children.Add(contactNumber); 
  
            var viewcell = new ViewCell() 
            { 
                View = stack, 
            }; 
            
            return viewcell; 
  
        }); 
  
        PopupDate.PopupView.ContentTemplate = customTemplate; 
        PopupDate.Show(); 
    } 
  
  
Refer the below sample for more details. 

Regards, 
Sivaraman 



SP Subburaj Pandian Veluchamy Syncfusion Team March 22, 2019 01:01 PM UTC

Hi Eugen, 
 
Thank you for your patience. 
 
We confirmed that the issue with “Binded values are not updated in ContentTemplate in Forms.Android and Forms.iOS” is a defect and we have logged a defect report. The fix for this issue is estimated to be available in the upcoming release 2019 volume 1 service pack 1 which is scheduled to be rolled by the end of April.  
 
You can track the status of the report by the following link, 
 
 
Regards,
Subburaj Pandian V 


Loader.
Live Chat Icon For mobile
Up arrow icon