.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Ribbon Control

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1075 Views, 3 Replies

Custom Ribbon Control

I'm trying to develop some custom commands in the ribbon, but I'm having trouble putting the code together.  The goal is to move a WPF control I already have to a contextual ribbon tab.  The issue seems to lie in turning the control into a resourcedictionary rather than a window or user control.  When the control is a resource dictionary, I'm unable to name the controls inside the dictionary, and therefore unable to write event handlers and access the controls in code behind.

 

I have attached a project which shows the basic functionality of what I'm trying to achieve.  The command "LAS" is the original command which simply allows the user to change the current layer.  The command "LASX" is the ribbon version, which creates a tab and reads in the resource dictionary, and then fails because the Textbox and Listbox defined in the XAML both have names assigned to them.  While I'm able to create an event without the name, I'm not able to access the controls.  I'm looking for someone to push me in the right direction as to creating custom controls inside the ribbon.  Posts on this forum and code examples online all show how to create a ribbon in code behind, but only with standard items, nothing custom.

 

Thanks for the help.

-Mark P.

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

While I'm on the subject I'm also having some issues with contextual tabs.  Basically I am trying to run the contextual tab during a command (Similar to how the hatch command is setup).  I create it, add it, make it visible and active, the command runs, then I set the tab to IsVisible = false and IsActive = false.  All of this code essentially came out of an AU sample on the ribbon.  Everything works perfectly but only on the first run.  After the first time, the tab pops up for a split second then dissapears.  I've tried different methods like adding and destroying the tab every time, but it still doesn't show up after the first invocation.

 

Thanks for the help in advance.

-Mark P.

Message 3 of 4
Mikko
in reply to: Anonymous

xmlns:adw="clr-namespace:Autodesk.Internal.Windows;assembly=AdWindows"
 
In your example you are using an Internal namespace, I don't know if I would unless necessary.
 
xmlns:adw="clr-namespace:Autodesk.Windows;assembly=AdWindows"
 
Anyhow here is something to look at.  I don't know if this is what you are looking to do but I played with this a few days ago and changed a few things you did and ended up with this.
 
I don't think you can get too custom with this unless you open a child window from the ribbon such as a tool tip where I think you can use custom controls.  I may be wrong, I haven't played with this enough to know.
Message 4 of 4
Anonymous
in reply to: Mikko

Thanks for taking the time to look at my code.  I guess my objective was really to integrate some controls that I had written into the ribbon, and then put them on a contextual tab.  I think you are right about not being able to get too custom with the controls.

 

Thanks for the help. 

-Mark

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report