Hello to all,
i do have quite a simple question:
How can i disable a GalleryItem ?
I am populating the items dynamically in Code Behind.
Depending on the Application State, some Selections are not allowed, so i want to disable the related items.
A workaround would be a filtering of the items when my Appliocation state changes, but i dont like that very much.
I know , its not really the proposed way to work with a ribbon gallery, but at this time i would like to go that way.
Any suggestions are welcome.
Thanks
Thomas
Hello Thomas,
In order to disable a GalleryItem, I would recommend that you write a Style for GalleryItemPresenter. From there you can use the Style’s Triggers or a converter on a setter for IsEnabled to determine the enabled status of the corresponding GalleryItem. The GalleryItem itself will be the data context of the GalleryItemPresenter and so that it what you will be binding to if not using a RelativeSource binding.
I am attaching a sample project that demonstrates the ability to disable the GalleryItem.
Please let me know if you have any other questions or concerns on this matter.
XamRibbonDisableGalleryItem.zip
Hi Andrew,
thanks for your quick answer.
It points me to the right direction, what i would like to accomplish is to set the enabled state of the items in code behind.
The items itself also are added in code behind.
Thanks,