RibbonView & PRISM - Some Tabs not showing

3 posts, 1 answers
  1. Hans
    Hans avatar
    2 posts
    Member since:
    Feb 2013

    Posted 26 May 2014 Link to this post

    Hi!

    At the moment, I'm writing an application using the RadRibbonWindow, a RadRibbonView and PRISM. Today I encountered a problem and I'm not sure if this is a bug or me doing something the wrong way.

    The application consists of these main parts:
    -The shell (A RadRibbonWindow)
    -A RadRibbonView hosted inside the Window (it has the RegionManager.RegionName set to "RibbonView")
    -Multiple modules each containing RadRibbonTabs (some have the ContextualGroupName where needed
    -Each module is added to the region using the [ViewExport(RegionName="RibbonView")] attribute and the AutoPopulateExportedViewsBehavior
    -Implicit Styles are used (Office 2013)

    Now the strange part:
    Only RibbonTabs having the ContextualGroupName set are visible in the RibbonView (as expected), but injected tabs having this attribute not set are not visible (I expected them to show up permanent)

    Remarks:
    Somewhere in this forum I read that an additional RegionAdapter is not needed in my case, because each injected usercontrol derives directly from RadRibbonTab. I think Tina mentioned this in one of her posts. Some tabs show up so I guess this is right, isn't it?
    Nevertheless I experimented with RegionAdapters but had no success.

    I would appreciate any help or hint getting my problem solved :) Many thanks in advance!

    btw.: I'm already using Q1 2014
  2. Answer
    Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 27 May 2014 Link to this post

    Hello Hans,

    The Implicit Style can not be applied to derived controls as their TargetType is different than the one defined in the Implicit Style. If you set the style implicitly, the style is applied only to the types that match the TargetType exactly and not to elements derived from the TargetType value. You can find more information on the topic in the remarks of the Style property definition.

    This is why in order to apply a Telerik predefined style on a UserControl deriving from RadRibbonTab, you  need to add a Style targeting the UserControl type in the Resources of the application. It is best to define that style after merging the Telerik ResourseDictionaries so that you can base the UserControl Style on the predefined "RadRibbonTabStyle".
    Another approach is to add the style directly to the modules of your RadRibbonTabs, like follows:
    <telerik:RadRibbonTab x:Class="TestApplication.RibbonTab1"
          Style="{StaticResource RadRibbonTabStyle}"
    ...

    I hope this information helps.

    Regards,
    Kiril Vandov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Hans
    Hans avatar
    2 posts
    Member since:
    Feb 2013

    Posted 27 May 2014 in reply to Kiril Vandov Link to this post

    Ahhh, ok. That was exactly my problem. Now everything is working as expected. Simply setting the Style in the modules did the trick. Thank you so much!!!
Back to Top