No ItemsSource for QAT?

Ribbon for WPF Forum

Posted 13 years ago by Josh Luth - Software Developer, Esha Research
Avatar
Am I missing something or is not possible to Bind the QAT to an ItemSource? In the samples you have each button defined explicitly in the QAT rather than bound to a collection.

Thoughts?

Comments (5)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Josh,

Sorry but the QAT items aren't bindable as we need to be able to continuously modify them based on if the end user takes various actions like adding items to the QAT, etc.


Actipro Software Support

Posted 13 years ago by Rory Plaire
Avatar
I'm sorry, but I just can't understand this response.

Allowing users to add items dynamically at runtime and display views for those items is the whole _point_ of MVVM and binding to an ItemsSource. What you've described is the exact reason you _would_ want to create a bindable ItemsSource... What am I missing?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Rory,

While it's true the QAT could offer an ItemsSource property for presentation, there is more going on with that control. The end-user can add/remove items interactively. In order to support that, we have to be able to modify the list of items in the QAT. This isn't something that is really possible when using ItemsSource, or generally done. I'm not aware of any WPF controls that would modify the list bound to an ItemsSource property. Even the QAT in the Microsoft Ribbon does not allow the use of the ItemsSource property, eventhough it exposes it.


Actipro Software Support

Posted 13 years ago by Rory Plaire
Avatar
I add and remove items in an ObservableCollection which serves as an ItemsSource for any WPF control which inherits from ItemsControl frequently. It's routine. I add and remove items from the collection, and the corresponding visuals are added and removed from the WPF control. I'm confused as to how you seem to be describing this very scenario and then claiming it is not possible.

Also, I think we can all agree that MS's ribbon suffers from serious design defects when trying to use it with MVVM. The entire reason Actipro ribbon stands out is that it is (mostly) MVVM-friendly.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Rory,

Yes, you can modify the collection, but there are no WPF controls that modify the collection for you and that's the point here. For example, a ListBox would never remove an item from your collection. When you bind a collection to a ListBox's ItemsSource, your items will appear in the Items collection. But you can no longer add/remove items from the Items collection using the Add/Remove methods. So effectively, by using ItemsSource you are telling the WPF control that only your code can add or remove items. In the case of Ribbon, we need to be adding to and removing from that source collection.

This could probably be solved using one or more events that would need to be added for us to notify you when a QAT item is being added/removed, but would still require you to manually update the bound collection on our behalf, and there would be other subsequent issues to solve.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.