/// <summary>
        /// Fill the palette combobox with the available palette representations.
        /// </summary>
        public void FillPaletteComboBox()
        {
            try
            {
                Palettes    palettes    = AppContext.Palettes;
                PixelFormat pixelFormat = PixelFormats.Indexed8;
                int         width       = (int)cbImageRepresentation.Width - 24;
                var         height      = (int)cbImageRepresentation.Height;
                int         stride      = width * (pixelFormat.BitsPerPixel / 8);

                for (int i = 0; i < palettes.Count; i++)
                {
                    // get the palette data
                    KeyValuePair <string, BitmapPalette> kvp = palettes.GetNamePalettePair(i);
                    string paletteName = kvp.Key;
                    var    comboItem   = new Image();

                    // the bitmapsource...
                    // allocate the bitmap's bits
                    var bits = new byte[height * stride];

                    // fill the bits with colorinformation
                    for (int x = 0; x < width; x++)
                    {
                        for (int y = 0; y < height; y++)
                        {
                            bits[x + (y * stride)] = (byte)((x * 256) / width);
                        }
                    }

                    // finally create the BitmapSource object
                    BitmapSource bitmap = BitmapSource.Create(width, height, 96.0, 96.0, PixelFormats.Indexed8, kvp.Value, bits, stride);
                    comboItem.Source              = bitmap;
                    comboItem.ToolTip             = paletteName;
                    comboItem.Stretch             = Stretch.Fill;
                    comboItem.VerticalAlignment   = VerticalAlignment.Stretch;
                    comboItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                    cbImageRepresentation.Items.Add(comboItem);
                    cbImageRepresentation.Items.Add(paletteName);
                }

                this.cbImageRepresentation.SelectedIndex = this.paletteIndex;
                var currentImage = cbImageRepresentation.Items[cbImageRepresentation.SelectedIndex] as Image;
                if (currentImage != null)
                {
                    this.paletteToolTip.Source         = currentImage.Source;
                    this.cbImageRepresentation.ToolTip = this.paletteToolTip;
                }
            }
            catch (Exception e)
            {
                Util.ReportException(e);
            }
        }