Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
Changing appearance of image area on popup tool
posted

Hi,

I have a popup menu on a ribbon with the following layout:

Main Popup (labels display as headers) >
Label
ListTool
SubPopup
Label (IsFirstInGroup = True)
ListTool
SubPopup

Please see the screen shot attached.

What I want to do is make it so the background colors cover the image area on the popup menu too.  But I can't figure out how this is done.

I have set AppearancesSmall.Appearance.BackColor, BackColor2, and BackGradientStyle for all of the tools in my Main popup menu.

I did not change any of the appearance properties on the main popup menu because I need to display 2 different sets of colors in the popup.

How can i change the back color of the image area on the popup tool so that the shading spans from the left edge of the popup menu all the way to the right edge.

Thanks,
~Karen


 

Parents
No Data
Reply
  • 44743
    posted

    The tool's appearance does not extend into the icon area. The only way you can accomplish what you are trying to do is by using a draw filter like the one below:

    public class MyDrawFilter : IUIElementDrawFilter
    {
     #region IUIElementDrawFilter Members

     bool IUIElementDrawFilter.DrawElement( DrawPhase drawPhase, ref UIElementDrawParams drawParams )
     {
      ToolBase tool = (ToolBase)drawParams.Element.GetContext( typeof( ToolBase ) );

      // Only use the draw filter for button tools
      ButtonTool buttonTool = tool as ButtonTool;
      if ( buttonTool == null )
       return false;

      // If the tool has no shared appearance set, use the default drawing logic
      if ( buttonTool.SharedProps.AppearancesSmall.Appearance.ShouldSerialize() == false )
       return false;

      drawParams.DrawBackColor( drawParams.InvalidRect );
      return true;
     }

     DrawPhase IUIElementDrawFilter.GetPhasesToFilter( ref UIElementDrawParams drawParams )
     {
      if ( drawParams.Element is PopupMenuItemUIElement )
       return DrawPhase.BeforeDrawBackColor;

      return DrawPhase.None;
     }

     #endregion
    }

    You might have to change or remove the check for buttonTool.SharedProps.AppearancesSmall.Appearance.ShouldSerialize(), depending on where you defined the back colors for the tools.

Children
No Data