public MenuItem GetKeyColorsMenuItem(RasterLayer layer)
        {
            var menuItem = new MenuItem();

            menuItem.Header = "Transparency Colors";
            menuItem.Icon   = new Image()
            {
                Source = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/Transparent.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            menuItem.Click += (s, e) =>
            {
                if (layer != null)
                {
                    MrSidKeyColorConfigureWindow window = new MrSidKeyColorConfigureWindow(layer.KeyColors);
                    if (window.ShowDialog().GetValueOrDefault())
                    {
                        MrSidKeyColorConfigureViewModel model = window.DataContext as MrSidKeyColorConfigureViewModel;
                        layer.KeyColors.Clear();

                        foreach (var color in model.Colors)
                        {
                            layer.KeyColors.Add(new GeoColor(color.Color.A, color.Color.R, color.Color.G, color.Color.B));
                        }
                        TileOverlay tileOverlay = LayerListHelper.FindMapElementInLayerList <TileOverlay>(GisEditor.LayerListManager.SelectedLayerListItem);
                        if (tileOverlay != null)
                        {
                            tileOverlay.Refresh();
                        }
                    }
                }
            };

            return(menuItem);
        }
        public MrSidKeyColorConfigureWindow(Collection <GeoColor> colors)
        {
            InitializeComponent();

            if (colors != null)
            {
                if (colors.Count < 22)
                {
                    int colorLength = 22 - colors.Count;
                    for (int i = 0; i < colorLength; i++)
                    {
                        colors.Add(new GeoColor());
                    }
                }

                DataContext = new MrSidKeyColorConfigureViewModel(CreatePalette(colors));
            }
        }