This is a migrated thread and some comments may be shown as answers.

RadRibbonView Prism Support Contextual

10 Answers 348 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 10 Aug 2011, 02:51 PM
I have been working on enabling prism support on your Silverlight RadRibbonView which is simple if you don't need to support injected Contextual tabs. When injecting contextual tabs it requires you also create the RadRibbonContextualGroup which controls the tab's color and visibility. To over come this problem I was going to create a new RadRibbonContextualTab which would extend RadRibbonTab. I was hoping that this new class could find/create the RadRibbonContextualGroup but it can't get it's ParentRibbon control. I noticed in the debugger that there is a non-public property named "ParentRibbon", is there any way to get to this property?? Do you have any example which enabled Prism support for the RadRibbonView?

Thanks in advance,
Bryan

10 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 10 Aug 2011, 03:04 PM
Hello Bryan,

I am not really sure how you add contextual groups and contextual tabs in your scenario and thsi is why I attached a sample project demonstrating how to use the RadRibbonView as a region in a PRISM scenario. The RadRibbonView control has one ContextualGroup and there is a module that is used to load a RadRibbonTab as a contextual tab in that group.

Basically in the RibbonView the contextual tabs are RadRibbonTabs that have a ContextualGroupName property set. Based on that property the RibbonTab can be displayed in a ContextualGroup - the group wich x:Name property matches the RibbonTab.ContextualGroupName property.

I hope this information helps.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Tej
Top achievements
Rank 1
answered on 06 Jun 2012, 04:37 PM
Hi,

I am trying to evaluate RadRibbonView with Prism in Silverlight 5. I downloaded the sample code provided here. But, getting build errors when I try to build and run the application.

Following is the error message I am getting:  "Error 37 The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) 

I am using trail version of the "Silver Light Telerik controls".

I tried by removing the references to telerik dlls and adding them again pointing to "C:\Program Files (x86)\Telerik\RadControls for Silverlight Q1 2012 SP1\Binaries\Silverlight" , but still getting the same errors.

Can any one help me in figuring out the issue?

Thanks,
Tej

0
Tina Stancheva
Telerik team
answered on 07 Jun 2012, 09:03 AM
Hello,

It seems there is an issue with the referenced assemblies, so I want to thank Tej for bringing it to our attention. Due to this issue, I updated the solution to reference the assemblies from the Q1 2012 SP1 release. Also, please keep in mind to set the Shell.Web project as a start-up project of the solution.

Hope this helps.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Rishabh
Top achievements
Rank 1
answered on 07 Jun 2012, 09:57 AM
Hi Tina,

I have an issue with the contextual tabs when using MVVM. I also encounter this issue in the project you have attached(the first one).

The issue is: in the GroupHeaderTemplate, if we provide an ItemTemplateSelector to select the Template for the contents of the RadRibbonGroup, the appropriate Template is not generated, only a TextBlock is generated. This seems to be a bug as I've used the same ItemTemplateSelector for non-contextual tabs and their contents are generating fine. Also, if we don't use the ItemTemplateSelector and instead give an ItemTemplate, the contents are generating fine.

This is the code that causes the problem.
<telerik:HierarchicalDataTemplate x:Name="GroupHeaderTemplate"
               ItemsSource="{Binding Buttons}"
               ItemTemplateSelector="{StaticResource groupsSelector}">
    <TextBlock Text="{Binding Text}" />
</telerik:HierarchicalDataTemplate>


I encountered this issue in a project and was searching related to it. Then I came across the sample you attached and encountered the same issue.

Steps to reproduce:
  1. Build and run the project.
  2. Open any contextual tab
  3. Click Add Button
Result - A button is added to a group in the selected contextual tab but if you hover over it, it would be clear that it is not actually a button. Also, when you check the UI with UI Spy, it becomes clear that the added element is a TextBlock and not a RadButton or any other desired Template Item.
0
Viktor Tsvetkov
Telerik team
answered on 12 Jun 2012, 01:44 PM
Hello Rishabh,

I have logged this issue in our PITS under the name "RibbonView: ItemTemplateSelector not working for contextual tabs" and it will be ready for tracking and voting tomorrow the latest. I have updated your Telerik points.

Kind regards,
Viktor Tsvetkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Deepak
Top achievements
Rank 1
answered on 20 Jul 2012, 03:49 AM
Hi ,

This issue is becoming a show stopper for me... Is there a work around for this? Basically I have a Prism-MVVM applications. Each Module injects a Contextual Tab. The Groups and Buttons are added as per th eattached code. I do not see the Buttons for reasons mentioned above. I just see teh groups...  I checked PITS and thsi is not being resolved. Is there a work around for this?


Thanks,

0
Deepak
Top achievements
Rank 1
answered on 20 Jul 2012, 03:52 AM
Rishab,

Did you find a workaround? how did you get around thsi issue?

Thanks
0
Viktor Tsvetkov
Telerik team
answered on 24 Jul 2012, 10:11 AM
Hello Deepak,

This issue is not resolved and unfortunately there is no workaround, so currently you shouldn't use ItemTemplateSelector for the items in a contextual tab's RadRibbonGroup.

Greetings,
Viktor Tsvetkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Deepak
Top achievements
Rank 1
answered on 25 Jul 2012, 05:16 AM
Victor ,

Can you provide a sample application that shows how to add Groups and Buttons to a Contextual Tab (Defined in a ViewModel ) without using ItemTemplateSelector?

I did  code the buttons right into my XAML without using the ViewModel but this breaks my UI design guidelines.

Thanks,
Deepak
0
Tina Stancheva
Telerik team
answered on 27 Jul 2012, 01:34 PM
Hi Deepak,

As the ItemTemplateSelector property doesn't work, you can implement a workaround approach. You can define an ItemTemplate for the RibbonGroups' Content. Then you can create a ContentPresenter to display the content of the groups and use binding through a converter to choose the appropriate DataTemplate based on teh type of data:

<DataTemplate x:Key="GroupContentTemplate">
    <ContentPresenter Content="{Binding}" ContentTemplate="{Binding Converter={StaticResource MyConverter}}" />
</DataTemplate>
 
<telerik:HierarchicalDataTemplate x:Name="GroupHeaderTemplate"
      ItemsSource="{Binding Buttons}"
      ItemTemplate="{StaticResource GroupContentTemplate}">
    <TextBlock Text="{Binding Text}" />
</telerik:HierarchicalDataTemplate>
and the TemplateConverter implementation looks like that:
public class TemplateConverter : IValueConverter
{
    public DataTemplate Button { get; set; }
    public DataTemplate SplitButton { get; set; }
    public DataTemplate ButtonsGroup { get; set; }
    public DataTemplate SmallButtonGroup { get; set; }
 
    #region IValueConverter Members
 
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value is SplitButtonViewModel)
        {
            return SplitButton;
        }
        else if (value is ButtonGroupViewModel)
        {
            return ((ButtonGroupViewModel)value).IsSmallGroup ? SmallButtonGroup : ButtonsGroup;
        }
        else
        {
            return Button;
        }
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
 
    #endregion
}

I attached a sample solution demonstrating this approach. Let meknow if it helps.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RibbonView and RibbonWindow
Asked by
Bryan
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Tej
Top achievements
Rank 1
Rishabh
Top achievements
Rank 1
Viktor Tsvetkov
Telerik team
Deepak
Top achievements
Rank 1
Share this question
or