AddToQuickAccessToolBar

Sep 1, 2010 at 11:10 AM

I'm trying to programmatically add items to the QA toolbar, e.g., replacing

          <Fluent:Ribbon.QuickAccessItems>
<
Fluent:QuickAccessMenuItem Target="{Binding ElementName=buttonGreen}"/>
          </Fluent:Ribbon.QuickAccessItems>

with something like:

ribbon.AddToQuickAccessToolBar(buttonGreen);
or
ribbon.AddToQuickAccessToolBar(buttonGreen.CreateQuickAccessItem());
or
ribbon.AddToQuickAccessToolBar(new QuickAccessMenuItem() { Target = buttonGreen });

but all of these behave strange. (There's no entry in the QA dropdown. There are strange debug output error messages like "Error while QAT items loading: one of the paths is invalid" and "Control SplitButton is not found in logical tree during QAT saving". Sometimes additional, "empty" QA buttons appear.)

How is this supposed to be used correctly?

Thanks for any help.

Coordinator
Sep 1, 2010 at 12:53 PM

I suppose you need ribbon.QuickAccessItems.Add(new QuickAccessMenuItem() { Target = buttonGreen });
The debug messages, probably, due to the control is not in the Ribbon yet.

Daniel

Sep 1, 2010 at 2:22 PM
Edited Sep 1, 2010 at 2:36 PM

Ah ok, thanks!

So to get it to appear in the dropdown I first need:
ribbon.QuickAccessItems.Add(new QuickAccessMenuItem() { Target = buttonGreen });

 and then to get it to appear in the QA by default:
ribbon.AddToQuickAccessToolBar(buttonGreen);

Does that sound right? (Edit: Or just ribbon.QuickAccessItems.Add(new QuickAccessMenuItem() { Target = buttonGreen, IsChecked = true });  ?)

----

When buttonGreen is a SplitButton this really adds a small QA SplitButton. Is it possible to add just the "main button" of the SplitButton somehow? (Similar to how rightclicking the original SplitButton and selecting "Add to Quick Access Toolbar" does this.)

----

> The debug messages, probably, due to the control is not in the Ribbon yet.

Huh? Ok, I notice the debug messages are actually written before I'm trying to do anything related to QA. (They appear when the first Tab is inserted into ribbon.Tabs).

Does the ribbon try to "remember" the QA items? Can this be configured/disabled/controlled somehow?

 

Thanks again.

Sep 1, 2010 at 2:27 PM

Just found this:

AutomaticStateManagement

I guess that is related to my last question above? There wouldn't happen to be some documentation / sample about this?