Create drop down list button in the ribbon like the views?

Create drop down list button in the ribbon like the views?

jholdawayUKBGN
Contributor Contributor
640 Views
3 Replies
Message 1 of 4

Create drop down list button in the ribbon like the views?

jholdawayUKBGN
Contributor
Contributor

Hello,

 

I'm trying to create a button in the ribbon that acts like the views or the insert button in AutoCAD.

The button should look and feel like the insert button, and the dropdown list should act like a list as in the views.

 

list button.png

 

Any help to get started?  I've started to play around with the RibbonListButton but I'm struggling.

Any advice would be greatly appreciated.

 

 

0 Likes
641 Views
3 Replies
Replies (3)
Message 2 of 4

nshupeFMPE3
Advocate
Advocate

I'm not really familiar with working with the ribbon through the API, but I know you can do this easily with CUI controls from within autocad?

0 Likes
Message 3 of 4

jholdawayUKBGN
Contributor
Contributor

I can get the large button to work with the following code:

jholdawayUKBGN_0-1665587289227.png

				var galleryButton = new RibbonGallery();
				galleryButton.Id = "testcombo";
				galleryButton.Name = "Views";
				galleryButton.DisplayMode = GalleryDisplayMode.LargeButton;
				galleryButton.Text = "Views";

				galleryButton.LargeImage = (ImageSource)Theme.Instance.ActiveResourceDictionary["SimulateImage"];
				galleryButton.Image = (ImageSource)Theme.Instance.ActiveResourceDictionary["SimulateScenariosImage"];
				rowPanel.Items.Add(galleryButton);

				var buttonGallery = new RibbonButton()
				{
					Name = "Button2",
					Text = "My Button2",
					Id = "ID_Button2",
					ShowText = true,
					ShowImage = false,
					Size = RibbonItemSize.Standard,
					Orientation = System.Windows.Controls.Orientation.Horizontal
				};
				galleryButton.Items.Add(buttonGallery);

				buttonGallery = new RibbonButton()
				{
					Name = "Button3",
					Text = "My Button3",
					Id = "ID_Button3",
					ShowText = true,
					ShowImage = false,
					Size = RibbonItemSize.Standard,
					Orientation = System.Windows.Controls.Orientation.Horizontal
				};
				galleryButton.Items.Add(buttonGallery);
				
				//add menu buttons
				RibbonButton button1 = new RibbonButton();
				button1.Name = "MyButton";
				button1.Text = "My Button";
				button1.Id = "MyButtonId";
				galleryButton.MenuItems.Add(button1);
				RibbonButton button2 = new RibbonButton();
				button2.Name = "MyOtherButton";
				button2.Text = "My Other Button";
				button2.Id = "MyOtherButtonId";
				galleryButton.MenuItems.Add(button2);

 

However, the gallery items is still the large icon and text.  I'm trying to figure out how to be a single row like the Views in the first picture I posted.

 

Second, I would like to use a small button dropdown instead of the large one.  When I change the DisplayMode on the RibbonGallery, this is what I get:

jholdawayUKBGN_1-1665587731486.png

 

jholdawayUKBGN_2-1665588113810.png

 

 

Any help would be greatly appreciated!

Thanks!

0 Likes
Message 4 of 4

hosneyalaa
Advisor
Advisor
0 Likes