The standalone control KryptonGallery has been added into the ribbon assembly. Note this means it is not part of the free KryptonToolkit. If you purchased the KryptonRibbon or KryptonSuite products, and your 12 month subscription is still valid, then you will get this as part of the next release.
Here is a KryptonGallery on a panel…
Use the up/down buttons on the right side to scroll the displayed line and so access other images not currently visible. Because the above example is already on the top line the up arrow has been disabled, there are no lines above it to scroll into view.
It is possible to show more than a single line of images using the control. Just change the height so that the client area is tall enough to accommodate a second line and it will automatically do so. The control always tries to display as many images as possible given the available client space.
Clicking the drop down button shows a context menu that has all the images ready for user selection. In this example we have defined 16 images…
Be default the number of images per context menu line is that same as that currently showing in the gallery, in our case 4 wide. This way the context menu width is about the same as the client area of the gallery.
There are a couple of control properties than can be used to set the min/max number of items per line of the menu. This is required to intelligently handle edge cases. Imagine your gallery is reduced in width to show just a single image at a time. Now pressing the drop down button gives a context menu where it has just a single image per line, making it 16 rows high! Not an intelligent use of screen space. In that case having a minimum drop width of say 4 would be sensible.
Just before the context menu is shown an event is fired that allows you to customize the contents of the menu. This is great for situations where you want to add extra options. Here is an example where I add a horizontal separator and a Clear menu option in the event handler.
Finally we have the DropRanges collection property that is exposed by the KryptonGallery. If you ignore this collection property then you get the default appearance as seen previously, with all the images shown as one large group in the context menu. If you need to provide titled sections instead then add a KryptonGalleryDropRange per titled group to the collection.
The following image shows the result of adding two range definitions…
The first has a title of Text and is defined to show the first 8 images, the second group has a title of Arrows and shows the last 8 images. You can create as many ranges as you like and specify the range of images to show for each one. The combination of ranges and the ability to customize the menu using an event gives you full and easy control over the appearance.
Update: I just noticed the date, no this is not an April fools joke!