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.
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.
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.