private Color OverrideImageColor(PaletteState state)
        {
            // We only intercept if we have a content to use for redirection
            if (PaletteContent != null)
            {
                // We only override the normal/disabled states
                if ((state == PaletteState.Normal) ||
                    (state == PaletteState.Disabled))
                {
                    // Get the color map from the button spec
                    Color mapColor = _buttonSpec.GetColorMap(base.Target);

                    // If we are supposed to remap a color
                    if (mapColor != Color.Empty)
                    {
                        // Get the button style requested
                        ButtonStyle buttonStyle = _buttonSpec.GetStyle(base.Target);

                        // Only for ButtonSpec do we use the palette value
                        if (buttonStyle == ButtonStyle.ButtonSpec)
                        {
                            return(mapColor);
                        }
                    }
                }
            }

            return(Color.Empty);
        }
예제 #2
0
 /// <summary>
 /// Update the button style to reflect new button style setting.
 /// </summary>
 public void UpdateButtonStyle()
 {
     _palette.SetStyles(_buttonSpec.GetStyle(_redirector));
 }