KryptonPaletteContextMenu
This control is inherited from the KryptonContextMenu. It can be attached to any control that has the KryptonContextMenu property and provides a simple and easily configurable way to manage and switch between palettes.

Pre-configured Krypton palettes are shown in the list and when a user clicks on a palette the control will:
  1. adjust the associated KryptonManager's GlobalPaletteMode and GlobalPalette
  2. check the correct palette in the drop down
  3. optionally adjust the RenderMode of an associated StatusStrip
The control also attaches to the KryptonManager's OnGlobalPaletteChanged event to capture any programmatic palette changes (i.e. not through the UI itself) and adjust its state.

Here are the relevant properties:



Here is a brief explanation of each property:
  • MenuHeadingText — Controls the context menu heading in the drop down (for things like Available Themes vs. Available Palettes).
  • CustomPalettes — Controls which custom KryptonPalettes are available (more on that below).
  • IgnoreDuplicates — If set to true then duplicate palette names will be ignored, otherwise a DuplicatePaletteNameException will be thrown at runtime.
  • KryptonManager — Hooks it up to the parent form's KryptonManager.
  • SortPalettes — Controls the sort order of the context menu items, either Alphabetical, StandardFirst or CustomFirst. If not alphabetical the palettes are displayed in the same order they appear in the collection editor, with either the custom or standard ones first.
  • StandardPalettes — Controls which of the the standard (or built in) KryptonPaletteModes are available. Its populated with all palette modes by default, except Custom, which is ignored if included.
  • StatusStrip — Hooks it up to the parent form's StatusStrip so that its RenderMode can be controlled.
Here is a screen shot of the StandardPalettes Collection Editor:



and here is a screenshot of the CustomPalettes Editor:



As you can see the custom palettes are just simple classes (CustomPalette) with a few (hopefully self-explanatory) properties. In case it's not clear, the PaletteXml property is simply the XML representation of the custom palette, as can be seen here:



When you click on the ellipsis to edit the Palette XML field you'll get a dialog that allows you to import the palette easily:



These custom palettes are stored within the control and then created and applied on the fly.

Last edited Feb 22, 2010 at 9:18 PM by sdgough, version 6

Comments

No comments yet.