Not able to make the bindings work for items inside QuickAccessToolBarCommonItems

Ribbon for WPF Forum

Posted 1 month ago by Daniel Constantin - ModuleWorks GmbH
Version: 24.1.1
Avatar

Hi!

I try to set the visibility for the buttons inside QuickAccessToolBarCommonItems using bindings and convertors. For some reason the bindings does not work. I have these errors

11:29:26:702 System.Windows.Data Error: 40 : BindingExpression path error: 'CursorMode' property not found on 'object' ''RibbonWindowTitleBarViewModel' (HashCode=64771222)'. BindingExpression:Path=CursorMode; DataItem='RibbonWindowTitleBarViewModel' (HashCode=64771222); target element is 'Button' (Name=''); target property is 'NoTarget' (type 'Object')

What if I would need to put the ribbon on top of a normal Window and not a RibbonWindow ?

What do I need to do to make this work?

Kind regards,

Daniel

Comments (5)

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

The older Ribbon product's RibbonWindow will set an instance of RibbonWindowTitleBarViewModel as the inherited DataContext in the RibbonWindow's title bar area, since it needs information to render the QAT and title.  Your binding is probably using the inherited DataContext, which won't work since you'll be examining the RibbonWindowTitleBarViewModel instance instead of what you are trying to examine.

You could update your binding to possibly use ElementName or a direct Source to make it not use the inherited DataContext when in the title bar.


Actipro Software Support

Posted 1 month ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi!

How can I check if a button for example is part of the QuickAccessToolBarCommonItems? Can I maybe do this with a DataTrigger?

Looking at the parent of the buttons seems like they are directly under the Ribbon control.

Kind regards,

Daniel

Posted 30 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Could you provide more detailed information about your setup here so that we can see where and how you are creating these bindings?  At the moment, it's difficult to make suggestions since we don't know much about the situation. 

In general though, the binding error you indicated means your bindings are using an inherited DataContext, which will not work for binding to properties on controls in the title bar QAT.  If the bindings you use have a specific ElementName or Source assigned, then you probably will not run into the binding errors.


Actipro Software Support

Posted 19 days ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi!

I am just trying to change the visibility of the buttons from the QAT and also from the list of Customize QAT on top of the ribbon. I can change the visibility for the button inside the QAT but for the check box inside the Customize QAT popup I cannot. That popup is like just a list of items and enabling/disabling or changing the visibility of them in real time does not work.

Kind regards,

Daniel

Answer - Posted 19 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

When the menu items are created for items in Ribbon.QuickAccessToolBarCommonItems, it's not looking at the Visibility of those items.  It's simply enumerating the Ribbon.QuickAccessToolBarCommonItems collection and making related menu items.  You would need to add/remove from that Ribbon.QuickAccessToolBarCommonItems collection to adjust visibility of the checkable items in the menu.


Actipro Software Support

The latest build of this product (v24.1.2) was released 4 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.