I am trying to add a button to the ribbon using CommandBars, but I can't find any example or a way to do that.
I cannot use the CustomUI XML because I need to change the visibility of the button, and it is not supported by the CustomUI XML.
I have found a CommandBar called "Ribbon" with a CommandBarControl that is called "Ribbon" as well, but I don't see how I use it to place a button on "TabHome".
Does anyone know what am I missing here? or can point me out to an example?
Thanks!
As far as I know, you can't use CommandBars to control ribbon. And it makes no sense to do so, as CommandBars technology is depreciated for ribbon ui, and basically supported for compatibility only.
Did not quite get why you don't want to use ribbon xml to customize ribbon? It's the official way. To control button visibility, you should simply set a "getVisible" attribute of the button to your event handler (callback) and and in that callback return true/false to show/hide the button...
What you can't show/hide dynamically are built-in office buttons, but you should be able to show/hide your own buttons without any issues.
Looks quite similar to this one:
Is there a way to use VBA and XML to add a button to the Office 2010 Ribbon depending on a string in the file name?
Related
I'm using this third party control
http://officeribbon.codeplex.com/documentation
and i can't find the event when the tab is clicked
example picture:
what i want is to fire an event(execute some code) when file tab is clicked
and fire an event(execute some code) when Tags tab is clicked.
and what event do i need? i tried the events. but it doesnt work
im using c# 2010
i would suggest you can use inbuilt ribbon . these have all the functionality what we need , two type ribbons are available xml and visual designer . visual designer is easy to handle , work same like asp.net or winform control . Hope it will help if not so show your code.
I'm experimenting with some custom ribbons in excel, and once of the behaviors I want to try and achieve is to mimic the built-in excel ribbon disabled/enabled states. I.e. If I'm viewing a ChartSheet or if I'm in edit mode, most of the ribbon tabs/buttons grey out.
Is there a way I can read the enabled states off something like the Chart's Ribbon Tab group?
In my research, I haven't been able to find something that does this. The closest thing I've found is overriding the existing ribbons and encasing them in your own custom controls using the "startFromScratch" value, but this feature is more for me to control the visibility of built in tabs, which I don't need.
Thanks
Is there a way to add a customized lookupedit to DevExpress.XtraBars.Ribbon.RibbonControl? In my RibbonPageGroup, I can right click to add controls including LookUpEdit. But if I want to add my customized control to RibbonPageGroup, is it allowed and how to do that? I search online but didn't find much useful information about it. Thanks! I am working on WinForms.
This can be only done if this control is derived from the DevExpress.XtraEditors.BaseEdit class. Also, you should register the corresponding RepositoryItem as it is described in the How to register a custom editor for use in the XtraGrid article.
Is there any way how can I associate custom ribbon (custom tabs and buttons I created in VS designer) with a custom form region?
I know that I can extend the existing windows with my ribbon (such as Compose message, Contacts...), but how can I create a new tab with custom ribbons at the top and custom form region at the bottom. Do I have to create a custom message class?
Thanks.
You have to create a custom message class. Basically the ribbon and the form are two seperate mechanisms.
What you could try though, if its important for you, is invalidating the ribbon on activation of your form region and then programmatically update the ribbon according to your needs (dynamic updating of the ribbon at msdn).
If you mean it the other way around (showing a certain form region when your ribbon tab is activated) then you can't have it: there are no events/callbacks for the ribbon tabs being changed.
I have been trying to solve this issue and as Georg said the two are quite separate and behave very differently, so bringing them into line to make them appear like they are related is quite difficult.
You can have a look at my example twitter app at http://vstocontrib.codeplex.com/SourceControl/changeset/view/b35f26fdca15#src%2fDemos%2fTwitterFeedCore%2fTwitterFeed%2fContactFeed.cs
It relies on my VSTO contrib project, but it should allow you to easily achieve what you want.
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button look "pressed"?
Imagine this button is an on/off switch.
ToolStripButton has the Checked property, but the regular Button does not.
One method you can used to obtain this option is by placing a "CheckBox" object and changing its "Appearance" from "Normal" to "Button" this will give you the same functionality that I believe you are looking for.
You could probably also use the ControlPaint class for this.
I think you may need a ToggleButton. You can take a look at third party vendors of WinForms components such as Telerik, DevExpress, ComponentFactory, ViBlend which provide such control. They all provide toggle buttons.