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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use ContextTabGroups with MVVM?

Thread ID:

Created:

Updated:

Platform:

Replies:

121573 Jan 4,2016 08:59 AM UTC Oct 11,2017 03:04 AM UTC WPF 5
loading
Tags: Ribbon
Soon Hui Ngu
Asked On January 4, 2016 08:59 AM UTC

I'm providing all menu content dynamically from a viewmodel, as in this example:

Now I want to add some ContextTabGroups. If I statically define these groups in XAML, I get an InvalidOperationException:

"Items collection must be empty before using ItemsSource."

Trying to turn the ContextTabGroups into a binding doesn't make things any easier. The closest I managed to get was to create a custom converter to convert my viewmodel collection to a ContextTabGroupCollection, but this results in a similar exception:

<syncfusion:Ribbon ContextTabGroups="{Binding ContextTabGroups, Converter={StaticResource ContextTabGroupConverter}}" ItemsSource="{Binding MenuTabs}" />

"Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."

What is the correct way to achieve this? Or is databinding simply not possible with ContextTabGroups?





Mariappan S [Syncfusion]
Replied On January 5, 2016 07:26 AM UTC

Hi Soon,

We would like to inform you that we don’t have this support in “Need to provide MVVM support for Ribbon's ContextTabGroup” currently and so have logged feature report regarding this. A support incident to track the status of this feature has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents   

Please let me know if you have any questions.

Regards,
Mariappan S.

Konstantin
Replied On October 9, 2017 11:48 AM UTC

Hi,

Was this feature implemented? If yes, could you please provide an example?


Priyanga Balasubramaniam [Syncfusion]
Replied On October 10, 2017 08:56 AM UTC

Hi Konstantin,

Using “ContextGroupSource” and “ContextGroupContainerStyle” properties of Ribbon we can populate business object in ContextTabGroups of Ribbon. ContextTabGroup class have two properties “ItemsSource” and “ItemContainerStyle”. Using these properties, we can populate business object in RibbonTabs of each ContextTabGroup in Ribbon.

We have prepared the sample for the same.

You can find the sample from the below location.

Sample:RibbonSample_in_MVVM

Let us know if you need any other assistance on this.

Regards,
Priyanga B



Konstantin
Replied On October 10, 2017 11:19 AM UTC

Thank you for sample.


Priyanga Balasubramaniam [Syncfusion]
Replied On October 11, 2017 03:04 AM UTC

Hi Konstantin,

Thank you for the update.

Let us know if you need any other assistance on this.

Regards,
Priyanga B

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;