Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
Disable GalleryItem in xamRibbon
posted

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

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    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

Children