Hi,
We've been looking into using the XamRibbon and XamRibbonWindow and we have a couple of questions on how to do some things with that control.
Is there an easy way to change the color of the titlebar background?
Also is there a way to add our companies logo to the titlebar and have it appear to the left of the minimize button.
Thanks for any help with this.
Mike
Hello Michael,
There is no built-in way. You would have to retemplate our default styles which are located here:
C:\Program Files (x86)\Infragistics\202x.x\WPF\DefaultStyles\Ribbon
This was previously asked here:www.infragistics.com/.../colorised-the-window-title-bar-of-a-xamribbonwindow
Thank you for this information. I'll take a look at the content template and the post.
It's too bad that you guys don't give us access to those default styles without retemplating the control.
If we created our own Infragistics theme and applied it to the XamRibbon control could we then change the titlebar color without retemplating? Or do we have to retemplate no matter what?
I get that for our companies logo we would have to retemplate but just curious about changing the background color of the title bar using a custom theme.
Ok so I got the background color working and added the logo.
However, I got two other issues. The first is that I loaded the sample solution that was connected to the forum post
www.infragistics.com/.../colorised-the-window-title-bar-of-a-xamribbonwindow
into Visual Studio and I tried grabbing the title bar with the mouse and move the window but the window wouldn't move. Is there something in that example solution that is causing this. I have the same issue when adding the example code to my application. Can't move the window with the mouse.
The second thing I need to know how to do is set the text color of the title text in the title bar. I can't seem to find a way of doing that. We use a dark is blue color for the title bar background and the Office2013 theme color for the title text is black or close to black. So it's very hard to see
Along with that the minimize, maximize and close buttons are also very dark and I need to change there color as well.
If modifying/extending the office2013 theme would be better for accomplishing these change of color tasks then please let me know.
I did look at the links to the theming you gave me in your last post and it looked doable but the issue I have is that there are so many brushes that it's kind of hard knowing what each brush is used for. Is there some sort of guide that shows what brushes are used for?
Thanks
Hello,
I am able to move the window around with the sample in that thread when clicking and dragging the "red area". The ribbon window's WindowStyle property is set to None, so perhaps that's contributing to the issue. Or check for Focusable="False".
The title caption is derived from a ContentControl object that has a color #FF6D6D6D. The sample in that thread isn't using the entire default style so you can look for a keys in the styles.
eg.
<Setter Property="Foreground" Value="{DynamicResource {x:Static igRibbon:RibbonBrushKeys.CaptionActiveTextForegroundKey}}" />
I found my mistake with moving the window so all that seems to be working now.
I'll take a look at that style and setter to see if I can make that work.
I found a a style in the RibbonGeneric.xaml file called Caption ContentControl Style
<!-- =================================================================== --> <!-- Caption ContentControl Style --> <!-- =================================================================== -->
<Style TargetType="{x:Type ContentControl}" x:Key="{x:Static igRibbon:RibbonCaptionPanel.CaptionStyleKey}">
I added this to my XamRibbon.Resources and change the foreground to White just as a test and it worked and the title changed colors.
Did I do that correctly or is there another way of making this work that would be easier?
There is one issue though.
I've been putting all the styles and control templates I copied from the example solution into a resource dictionary which is located in a separate xaml file than my mainwindow.xaml. Everything has worked fine in that other xaml file except for this Caption ControlContent Style. If I put that in my resource dictionary in the other xaml file then the title doesn't change to the white color.
Any idea what that might be the case?
I also have to find the styles for the minimize, mazimize and close buttons and change their foreground color. I'll look through the RibbonGeneric.xaml file and see if I can find them.
Again if there is an easier way of doing this please let me know.
Check the output window if it mentions as issue with the x:Key. Sounds like the resource is not in scope for the rest of the application to see. The first place you can try is App.xaml, which can be used as a central hub for all your files to inherit from.
https://docs.microsoft.com/en-us/dotnet/desktop/wpf/app-development/how-to-use-an-application-scope-resource-dictionary?redirectedfrom=MSDN&view=netframeworkdesktop-4.8
It was probably working in MainWindow because the Ribbon is overriding it and the style is actually a local resource embedded directly.
Thank you for being patient and I am glad I was able to assist.
This was just what I needed. I don't have any other questions right now. Thank you for all your help and direction in helping me solve these issues. It is greatly appreciated.
Thanks I'll give it try and will let you know.
In the sample I provided you should see a Style targeting ApplicatinMenu2010Item on line 7179. There you can add Setters for Header and FontSize.
<Style TargetType="igRibbon:ApplicationMenu2010Item"> <Setter Property="Header"> <Setter.Value> <TextBlock Margin="5,0,0,0" Text="Just a button" /> </Setter.Value> </Setter> <Setter Property="FontSize" Value="25"/> <Setter Property="Background" Value="Transparent" /> <Setter Property="Template" Value="{DynamicResource {x:Static igRibbon:ApplicationMenu2010Item.ButtonTemplateKey}}" /> <Style.Triggers> <Trigger Property="ItemType" Value="Tab"> <Setter Property="Template" Value="{DynamicResource {x:Static igRibbon:ApplicationMenu2010Item.TabTemplateKey}}" /> </Trigger>
<!-- Do not show the default focus for buttons - only for the tabs --> <Trigger Property="ItemType" Value="Button"> <Setter Property="FocusVisualStyle"> <Setter.Value> <Style /> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style>
Sorry for not getting back to you sooner. I've got the dropdown button working the way I want. Thanks for the help.
My apologies but another question has come up.
How do I increase the text and image size of the Header of an ApplicationMenu2010Item? I think the ControlTemplate to use for that is this
<ControlTemplate TargetType="igRibbon:ApplicationMenu2010Item" x:Key="{x:Static igRibbon:ApplicationMenu2010Item.ButtonTemplateKey}">
However, for some reason no matter what I do to that template I'm not able to increase the size of the text or the image I want to show. Obviously, I'm missing something but I can't figure out what that might be.
Any ideas?