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

Adding the different itemsource for the Content inSfAccordion

Hi,In, My scenario i want to add different itemsource for the content in SfAccordion, In Content i have SfDataGrid for that i want to add the another itemsource, my code is in following document, any one please help me to solve this issue.Thanks & Regards,Sai Priya. CAttachment: Accordion_557f7f59.zip

11 Replies

VR Vijayalakshmi Roopkumar Syncfusion Team July 13, 2017 09:17 AM UTC

Hi SaiPriya

Thank you for contacting Syncfusion Support.

We could not find the reported attachment. Please share us the mentioned attachment to analyze and proceed further in this.

Regards,
Vijayalakshmi V.R.


SA SaiPriya July 13, 2017 09:48 AM UTC

Thanks for your reply vijayalakshmi RoopKumar,

It is my SfAccordion document, Please check once and help me to solve this issue.

Thanks & Regards,

Sai Priya. C


Attachment: SfAccordion_d9846644.zip


VR Vijayalakshmi Roopkumar Syncfusion Team July 17, 2017 07:16 AM UTC

Hi SaiPriya,

Thank you for your patience.

We have checked the reported requirement, "SfDatagrid does not bind on using different itemsources in SfAccordion content" in the provided code example, and observed that you did not set the DataContext to SfDataPager. That is the reason ItemSource in SfDatagrid did not correctly bind when it was placed as a SfAccordion content. We have modified the sample to meet your requirement. 
Code Example:[XAML] 
 
<!—DataContext set in datapager-->   
<datapager:SfDataPager x:Name="sfDataPager"   
Grid.Row="1"   
MinHeight="20"   
PageSize="10"   
AccentBackground="DarkCyan"   
AccentForeground="White"   
FontSize="12"   
UseOnDemandPaging="False"   
VerticalAlignment="Bottom"   
HorizontalAlignment="Right"   
NumericButtonCount="5"   
Source="{Binding Orders}" >   
<datapager:SfDataPager.DataContext>   
<local:ViewModel/>   
</datapager:SfDataPager.DataContext>   
</datapager:SfDataPager>   
   
   <!--Binding the data grid source in SfDataGrid-->   
   
<syncfusiongrid:SfDataGrid x:Name="sfCompanyGrid"   
Grid.Row="0"   
HorizontalAlignment="Stretch"   
HorizontalContentAlignment="Stretch"   
ItemsSource="{Binding ElementName=sfDataPager,Path=PagedSource}"   
AlternationCount="2"   
AutoGenerateColumns="True"   
SelectionMode="Single" BorderThickness="0"   
AllowRowHoverHighlighting="True"   
RowHoverHighlightingBrush="Azure"   
SelectionUnit="Row" Visibility="Visible"   
RowHeight="45" FontSize="12"   
Padding="8,0,8,0">   
   
 
 
 
 

Screenshot:


 
For more information on binding the SfDatagrid usingthe SfDataPager, please refer to the following UG link: https://help.syncfusion.com/wpf/sfdatapager/databinding#on-demandpaging

Please try this solution and let us know if this solves the issue or if we have misunderstood your requirement.

Regards,
Vijayalakshmi V.R.  



SA SaiPriya July 17, 2017 10:38 AM UTC

Thanks for your reply, I tried your example, but i'm giving the datacontext to the entire page like below codeDataContext="{Binding Users, Source={StaticResource Locator}}"I didn't mention the datacontext in Datapager, But i didnot get the values in SfDataGrid, it showing empty only, Can you please help me to solve this issue.


VR Venkateshwaran Ramdoss Syncfusion Team July 19, 2017 07:25 AM UTC

Hi Saipriya, 

Thank you for your update. 

We have checked the reported behavior with ListView control. It works as same as SfAccordion control and confirmed It’s the standard behavior of ItemsControl. We should give the ItemsControl items collection in the Model class. We have modified the sample based on your requirement. In this sample, we have move the Orders Observable collection into the Model class. We have prepared a sample for your reference and it can be downloaded from the below link. 

 
Screenshot 
 
 
 
Please check the above solution and let us know if it was helpful. 

Regards, 
Venkateshwaran V.R. 




SA SaiPriya July 26, 2017 06:10 AM UTC

Thanks for your Reply, Actually i tried your solution its working, But in my scenario if i clicked the accordion at that time i'm binding the child item (users) to the company  for example i have one class in that i'm having company name and in that class i have users class firstly i'm binding the company collection and then i'm binding the users collection, it shows the company list but if we click the company i have users in my collection but it was not showing users.  Please check the attached document for reference. I'm getting the companies list in UI and i'm also getting the users list in cs file but there was something went wrong users are not displayed, Hope u understand my scenario.

Thanks in advance.



Attachment: Accordian_Sample_5ccc829.zip


VR Vijayalakshmi Roopkumar Syncfusion Team July 27, 2017 11:59 AM UTC

Hi SaiPriya

Thank you for the update.

We have checked the provided code example and observed that you have get the details of CompanyList collection by using UserManagementService class, but we could not found the UserManagementService class in code example. So please share the sample which you have tried. It would be helpful for us to provide you the solution at the earliest.

Regards,
Vijayalakshmi V.R.


SA SaiPriya July 27, 2017 01:14 PM UTC

Thanks for your reply,

Why u need that, in that i'm calling the api and get the data as observable collection.



VR Vijayalakshmi Roopkumar Syncfusion Team July 28, 2017 04:03 PM UTC

Hi SaiPriya,

Thank you for the update.

We have prepared the sample using the provided code example and found that the Users List collection has not been displayed in the UI.

Screenshot:

The screenshot shows the item not displayed in UI
 


If this is the reported scenario, we suspect the item does not generate due to enabling the property “UseOnDemandPaging” in your code example. By disabling this, the UserList collection displayed in the UI. We have prepared the sample for the same. Please download it from following location :

Sample: http://www.syncfusion.com/downloads/support/forum/131486/ze/Accordionapp_(2)-1066690364 

Expected output:


 
Please let us know if we have misunderstood your requirement.

Regards,
Vijayalakshmi V.R. 



SA SaiPriya August 29, 2017 12:49 PM UTC

Thanks for your reply, 

In my scenario after clicking the company by using that company id i'm getting the users list dynamically, In your reply you are getting the users list dynamically, i have two different item sources to bind one is for accordion and another is for SFDataGrid(it is the content in Accordion). Please do useful sample.

Thanks & Regards,

Sai Priya. C



VR Vijayalakshmi Roopkumar Syncfusion Team August 31, 2017 01:48 AM UTC

Hi Sai Priya,

Thank you for the update.

We are regret that we are unable to understand your actual requirement. In our last update, we have maintaining two observable collection and binded it for SfAccordion and another for SfDataGrid which is the content for SfAccordion. Could you please check the below video which shows the user information on clicking the company ?

Video: accordionitems 
  
Please check the video and confirm us if we had misunderstood your requirement. If so, please let us know your exact requirement clearly by providing screenshot or scenario. It would be helpful for us to proceed further on this.

Regards,
Vijayalakshmi V.R. 


Loader.
Live Chat Icon For mobile
Up arrow icon