- Home
- Forum
- Xamarin.Forms
- Populating Items via ItemSource - multi-level
Populating Items via ItemSource - multi-level
Is it possible to load multiple levels of menu into the radial menu via a ViewModel?
Although I can see how to load items manually:
radialMenu.Items[n].Items.Add(colorSubMenuItem);
If I construct a ViewModel to take advantage of the ItemSource feature and MVVM, I cannot see how to create a structure to support nested menu
We have validated your query and currently we don't have support to add nested menu subitems via item source property in SfRadialMenu.
We suggest you can use SfRadialMenuItem collection from the view model to load nested items via the items property. We have created a sample to load items from view model's radialmenuitem collection. Please find the sample from below link
https://www.syncfusion.com/downloads/support/directtrac/166658/ze/GettingStarted-940620706
Please let us know if you have any other queries.
Regards,
Jeya K
Hi Jeya, thank-you for your response.
I don't seem to be able to download the sample? It says 'Access Denied'? I am logged in, as I would not be able to post this reply?
Can you please provide the sample again or update the link so that I can download it.
Thank-you Jeya, I will have a look at the sample
Hi Jeya, the sample has been very useful.
In my use-case, the menu could be n-levels deep. I have modified the sample to load a SfRadialMenuItem that displays a View (SfAvatar in this case), but only one level deep (there would be an indeterminate number of levels). I have attached an ItemTapped event to the SfRadialMenuItem, in order to load a second level for the item placed in the 'East' position (Alexander). This clears the EmployeeCollection, and loads with a new set of Employees. Although I can see that the EmployeeCollection as been refreshed, the display remains unaltered - the 'Items' binding is not working.
I would have expected the SfRadialMenu to refresh if Items is bound to the EmployeeCollection, which is Observable?
Attachment: Manually_Bound_to_VM_6bb246df.zip
We have validated your query and we suggest you set Items to the RadialMenuItem as like below code snippet to display the next level items. Please find the code snippet for this
Code snippet:
| private void RMI_ItemTapped(object sender, Syncfusion.SfRadialMenu.XForms.ItemTappedEventArgs e)
{
SfRadialMenuItem RMI = (SfRadialMenuItem)sender;
if (RMI.Text == "Alex")
{
RMI.Items = DisplayAlexLevel2Items();
}
private ObservableCollection<SfRadialMenuItem> DisplayAlexLevel2Items() {
EmployeeCollection.Clear();
AddRadialMenuItem("Ellie", "Ellie.png");
AddRadialMenuItem("Finley", "Finley.png");
AddRadialMenuItem("Gabriella", "Gabriella.png");
AddRadialMenuItem("Jackson", "Jackson.png");
AddRadialMenuItem("Jayden", "Jayden.png");
return EmployeeCollection; } |
Please find the modified sample from below link:
Sample link:
https://www.syncfusion.com/downloads/support/forum/166658/ze/GettingStarted672820239
Please check with the above and let us know if you have any concern.
Regards,
Jeya K
Hi Jeya, thank-you for the update. I have looked at the updated sample. I have further modified it to explore my use-case of n-levels by adding the following:
private ObservableCollection<SfRadialMenuItem> DisplayAlexLevel3Items()
{
EmployeeCollection.Clear();
AddRadialMenuItem("Kaylee", "Kaylee.png");
AddRadialMenuItem("Leila", "Leila.png");
AddRadialMenuItem("Lucy", "Lucy.png");
AddRadialMenuItem("Mckenna", "Mckenna.png");
AddRadialMenuItem("Michael", "Michael.png");
return EmployeeCollection;
}
private void RMI_ItemTapped(object sender, Syncfusion.SfRadialMenu.XForms.ItemTappedEventArgs e)
{
SfRadialMenuItem RMI = (SfRadialMenuItem)sender;
if (RMI.Text == "Alex")
{
RMI.Items = DisplayAlexLevel2Items();
}
else if (RMI.Text == "Ellie")
RMI.Items = DisplayAlexLevel3Items();
}
Unfortunately clicking on the 'level 2' menu item does not refresh to display 'level 3' items?
Sorry for the inconvenience caused.
We have validated your query and we are able to reproduce the reported issue in iOS platform. We have logged a defect report for this. You can track the status of the bug from the below link.
Feedback: https://www.syncfusion.com/feedback/26637/ios-next-level-sub-radial-menu-items-not-shown-when-clicking-radial-menu-item
Note: The provided feedback link is private, and you need to login to view this feedback.
We will provide the patch for this issue on July 14, 2021. We appreciate your patience until then.
Regards,
Jeya K
Thank-you Jeya.
Most welcome. As we promised, will update the patch for the reported issue on July 14, 2021.We appreciate your patience until then.
Regards,
Jeya K
Hi Jeya,
Is the patch available to test please?
We have fixed the reported issue in iOS and please find the custom assemblies from below link.
Custom assemblies : https://www.syncfusion.com/downloads/support/directtrac/general/ze/SubRadialMenu_Assembly1140522767
Assembly Version: 19.1.0.69
Since 19.1.0.69 is a weekly NuGet release, we are not able to generate patch in 19.1.0.69 version. We can generate patch only for Main release and SP1 release versions, so we have provided the custom assembly in 19.1.0.69.
Disclaimer:
Please note that we have created this patch for version 19.1.0.69 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received
Please refer the below link for how to apply custom assemblies.
https://www.syncfusion.com/kb/8279/how-to-apply-the-custom-assemblies-when-configured-the-project-with-syncfusion-nuget
The fix for the reported issue will be included in our upcoming weekly NuGet release which is expected to be rolled out on July 27, 2021. We appreciate your patience until then.
Regards,
Jeya K
Hi Jeya,
Thank-you for the custom assemblies, I have applied them to my test program. I can see that the images are now refreshed when the underlying collection is changed.
Is there a way of preventing the refresh when the bound collection is not modified? For instance at the top level, if you select 'Aiden' rather than 'Alex', there is no change to the underlying collection, but the menu collapses and refreshes anyway? This will be distracting to a user if an action is to be applied when there is no collection change?
Currently, we are validating on this and will update the details on July 20,2021.We appreciate your patience until then.
Regards,
Jeya K
Due to complexity, still we are validating on this and will update the details on July 23, 2021. We appreciate your patience until then.
Regards,
Jeya K
Hi Peter Mortley,
Thanks for your patience. We have fixed the reported issue and find the assembly from the link below.
Assembly Version: 19.1.0.69
Disclaimer: Please note that we have created this patch for the version v19.1.0.69 specifically to resolve the issue reported in this incident.
Assembly: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SubMenuItem_Assembly1858797492
Note: Please refer the below link to apply the custom assembly
Note: We have created this patch only for resolving this issue, based on your confirmation we will proceed further on our next release.
When using the same collection for SfRadialMenu Items and SfRadialMenuItem Items, the whole radial menu items are cleared when setting the SfRadialMenuItem items collection. So we have modified the sample. Check the sample from the below link:
Regards,
Ruba Shanmugam
Hi Ruba,
Thank-you for the update, I am in the process of evaluation.
Best Regards,
Peter.
Hi Ruba,
I have evaluated the solution, and can confirm that I am satisfied that it will now allow my intended use case.
Please continue to release the patch, and thank-you for your effort in resolving this issue,
With Best Regards,
Peter.
Thanks for the update.
The fix for the reported issue will be included in our upcoming weekly NuGet release which is expected to be rolled out on August 03, 2021. We appreciate your patience until then.
Regards,
Jeya K
Sorry for the inconvenience.
The fix for the reported issue is not included in this weekly release due to having some pending test cases to ensure that fix, so we were unable to move the fix. We will move the fix in our next weekly NuGet which is expected to be rolled out on August 10, 2021.
We appreciate your patience until then.
Regards,
Jeya K
- 23 Replies
- 3 Participants
-
PM Peter Mortley
- Jun 24, 2021 03:20 PM UTC
- Aug 17, 2021 11:33 AM UTC