The arrow of the Dialog Launcher button on my Ribbon panel does not show

By Adam Nagy

I set the DialogLauncher property of my RibbonPanelSource, but the icon does not appear on it:

Arrow1

static RibbonPanel AddOnePanel()
{
  RibbonButton rb;
  RibbonPanelSource rps = new RibbonPanelSource();
  rps.Title = "Test One";
  RibbonPanel rp = new RibbonPanel();
  rp.Source = rps;
 
  rb = new RibbonButton();
  rb.Name = "Test Button";
  rb.ShowText = true;
  rb.Text = "Test Button";
  // Add the Button to the Tab
  rps.Items.Add(rb);
 
  // Create a Command Item that the Dialog Launcher can use,
  // for this test it is just a place holder.
  RibbonCommandItem rci = new RibbonCommandItem();
  rci.Name = "TestCommand";
 
  // Assign the Command Item to the DialogLauncher which auto-enables
  // the little button at the lower right of a Panel, but where's 
  // the arrow you see in the stock Ribbons?
  rps.DialogLauncher = rci;
 
  return rp;
}

If I tried to set the image myself, that did not work either:

BitmapImage myBitMapImage = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block.
myBitMapImage.BeginInit();
// Change this string to a bmp file on your system
myBitMapImage.UriSource = new Uri("C:/temp.png",
                       UriKind.RelativeOrAbsolute);
 
myBitMapImage.EndInit();
 
rci.Image = myBitMapImage;
rci.LargeImage = myBitMapImage;

Solution

You need to use a RibbonButton and assign that to the DialogLauncher:

RibbonButton dialogLauncherButton = new RibbonButton();
dialogLauncherButton.Name = "TestCommand"; 
rps.DialogLauncher = dialogLauncherButton;

Arrow2


Comments

2 responses to “The arrow of the Dialog Launcher button on my Ribbon panel does not show”

  1. Very helpful post… a couple of questions though.
    What size should this image be? I would assume 16×16 but I’ve had issues even with regular button images at 16×16. What’s the best way to create these images? Thanks.

  2. Sebastian Avatar
    Sebastian

    Quite some time since…. but with Revit 2019/2020/2021 is doesn’t seem to work that way.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading