<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to arrange custom buttons in custom ribbon? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13231235#M1358</link>
    <description>&lt;P&gt;Hey there!&lt;/P&gt;&lt;P&gt;I have created a custom ribbon but now I need to arrange the buttons as I need but it doesn't fit well. So is there any way to fix the size and arrange it as we need. I want to arrange the buttons as shown in the below SS:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2024-12-27 101124.png" style="width: 542px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1449342iFB925212E75B35AF/image-dimensions/542x258?v=v2" width="542" height="258" role="button" title="Screenshot 2024-12-27 101124.png" alt="Screenshot 2024-12-27 101124.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But mine look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-12-27 101624.png" style="width: 768px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1449343i3F3BF64CD9799860/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-12-27 101624.png" alt="Screenshot 2024-12-27 101624.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;I forgot to share the code, so here is the code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void CreateRibbon()
{
    try
    {
        RibbonControl ribCntrl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl;
        if (ribCntrl == null) return;

        var existingTab = ribCntrl.Tabs.FirstOrDefault(t =&amp;gt; t.Id == MY_TAB_ID);
        if (existingTab != null &amp;amp;&amp;amp; existingTab.IsActive) return;

        if (existingTab != null)
        {
            ribCntrl.Tabs.Remove(existingTab);
        }

        RibbonTab ribTab = new RibbonTab { Title = "Advanced Tools", Id = MY_TAB_ID };
        ribCntrl.Tabs.Add(ribTab);

        AddSimplePanel(ribTab, "CAD Tools");

        if (wasActive)
            ribTab.IsActive = true;

        ribTab.Activated += RibTab_Activated;
        ribTab.Deactivated += RibTab_Deactivated;
    }
    catch (Exception ex)
    {
        Application.DocumentManager.MdiActiveDocument?.Editor.WriteMessage($"\nError creating ribbon tab: {ex.Message}");
    }
}

private void AddSimplePanel(RibbonTab tab, string panelTitle)
{
    RibbonRowBreak rbrk = new RibbonRowBreak();
    RibbonSubPanelSource rspl = new RibbonSubPanelSource();
    RibbonPanelSource panelSource = new RibbonPanelSource { Title = panelTitle };
    RibbonPanel ribPanel = new RibbonPanel { Source = panelSource };
    tab.Panels.Add(ribPanel);

    RibbonRowPanel rowPanel = new RibbonRowPanel();
    panelSource.Items.Add(rowPanel);

    var buttons = new[]
    {
        ("Command 1", "COMMAND1 "),
        ("Command 2", "COMMAND1 "),
        ("Command 3", "COMMAND1 "),

    };
    int count = 0;
    int index = 0;
    foreach (var (text, command) in buttons)
    {
        var button = new RibbonButton
        {
            Text = text,
            ShowText = true,
            Orientation = System.Windows.Controls.Orientation.Horizontal,
            Size = RibbonItemSize.Standard,
            CommandParameter = command,

        };
        button.CommandHandler = new RelayCommand();
        rowPanel.Items.Add(button);
    }
}&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 27 Dec 2024 07:08:55 GMT</pubDate>
    <dc:creator>luckyboy82292</dc:creator>
    <dc:date>2024-12-27T07:08:55Z</dc:date>
    <item>
      <title>How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13231235#M1358</link>
      <description>&lt;P&gt;Hey there!&lt;/P&gt;&lt;P&gt;I have created a custom ribbon but now I need to arrange the buttons as I need but it doesn't fit well. So is there any way to fix the size and arrange it as we need. I want to arrange the buttons as shown in the below SS:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2024-12-27 101124.png" style="width: 542px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1449342iFB925212E75B35AF/image-dimensions/542x258?v=v2" width="542" height="258" role="button" title="Screenshot 2024-12-27 101124.png" alt="Screenshot 2024-12-27 101124.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But mine look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-12-27 101624.png" style="width: 768px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1449343i3F3BF64CD9799860/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-12-27 101624.png" alt="Screenshot 2024-12-27 101624.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;I forgot to share the code, so here is the code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void CreateRibbon()
{
    try
    {
        RibbonControl ribCntrl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl;
        if (ribCntrl == null) return;

        var existingTab = ribCntrl.Tabs.FirstOrDefault(t =&amp;gt; t.Id == MY_TAB_ID);
        if (existingTab != null &amp;amp;&amp;amp; existingTab.IsActive) return;

        if (existingTab != null)
        {
            ribCntrl.Tabs.Remove(existingTab);
        }

        RibbonTab ribTab = new RibbonTab { Title = "Advanced Tools", Id = MY_TAB_ID };
        ribCntrl.Tabs.Add(ribTab);

        AddSimplePanel(ribTab, "CAD Tools");

        if (wasActive)
            ribTab.IsActive = true;

        ribTab.Activated += RibTab_Activated;
        ribTab.Deactivated += RibTab_Deactivated;
    }
    catch (Exception ex)
    {
        Application.DocumentManager.MdiActiveDocument?.Editor.WriteMessage($"\nError creating ribbon tab: {ex.Message}");
    }
}

private void AddSimplePanel(RibbonTab tab, string panelTitle)
{
    RibbonRowBreak rbrk = new RibbonRowBreak();
    RibbonSubPanelSource rspl = new RibbonSubPanelSource();
    RibbonPanelSource panelSource = new RibbonPanelSource { Title = panelTitle };
    RibbonPanel ribPanel = new RibbonPanel { Source = panelSource };
    tab.Panels.Add(ribPanel);

    RibbonRowPanel rowPanel = new RibbonRowPanel();
    panelSource.Items.Add(rowPanel);

    var buttons = new[]
    {
        ("Command 1", "COMMAND1 "),
        ("Command 2", "COMMAND1 "),
        ("Command 3", "COMMAND1 "),

    };
    int count = 0;
    int index = 0;
    foreach (var (text, command) in buttons)
    {
        var button = new RibbonButton
        {
            Text = text,
            ShowText = true,
            Orientation = System.Windows.Controls.Orientation.Horizontal,
            Size = RibbonItemSize.Standard,
            CommandParameter = command,

        };
        button.CommandHandler = new RelayCommand();
        rowPanel.Items.Add(button);
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 27 Dec 2024 07:08:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13231235#M1358</guid>
      <dc:creator>luckyboy82292</dc:creator>
      <dc:date>2024-12-27T07:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13231853#M1359</link>
      <description>&lt;P&gt;You need to use RibbonRowBreak, RibbonRowPanel... properly. For example, if I want to have a Panel hold 9 command buttons in 3 rows, and each row with 3 buttons, I can have code as shown below:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.Ribbon;
using Autodesk.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AcadMicsTests
{
    public class MyRibbon
    {
        private readonly RibbonControl _ribbonControl;
        private const string TAB_ID = "MY_CUSTOM_RIBBON_TAB";

        public MyRibbon()
        {
            _ribbonControl = ComponentManager.Ribbon;
        }

        public void CreateMyTab()
        {
            if (_ribbonControl==null)
            {
                throw new InvalidOperationException(
                    "Ribbon menu is not available.");
            }

            if (_ribbonControl.FindTab(TAB_ID) != null) return;

            BuildTab();
        }

        private void BuildTab()
        {
            var tab=new RibbonTab();
            tab.Title = "My Custom Tab";
            tab.Id= TAB_ID;
            AddRibbonPanelToTab(tab);
            _ribbonControl.Tabs.Add(tab);
            _ribbonControl.ActiveTab = tab;
        }

        private void AddRibbonPanelToTab(RibbonTab tab)
        {
            var source = new RibbonPanelSource { Title = "Custom Commands", Id = "MY_CUSTOM_COMMANDS" };
            var panel = new RibbonPanel { Source = source };

            RibbonRowPanel rowPanel;

            rowPanel = CreateRibbonRowPanel(
                new []
                {
                    new RibbonCommandButton{Text="Xxxxxx1", ShowText=true },
                    new RibbonCommandButton{Text="Xxxxxx2", ShowText=true },
                    new RibbonCommandButton{Text="Xxxxxx3", ShowText=true },
                });
            source.Items.Add(rowPanel);

            source.Items.Add(new RibbonRowBreak());

            rowPanel = CreateRibbonRowPanel(
                new []
                {
                    new RibbonCommandButton{Text="Yyyyyy1", ShowText = true},
                    new RibbonCommandButton{Text="Yyyyyy2", ShowText=true },
                    new RibbonCommandButton{Text="Yyyyyy3", ShowText = true},
                });
            source.Items.Add(rowPanel);

            source.Items.Add(new RibbonRowBreak());

            rowPanel = CreateRibbonRowPanel(
                new[]
                {
                    new RibbonCommandButton{Text="Zzzzzz1", ShowText=true },
                    new RibbonCommandButton{Text="Zzzzzz2", ShowText=true },
                    new RibbonCommandButton{Text="Zzzzzz3", ShowText=true },
                });
            source.Items.Add(rowPanel);

            tab.Panels.Add(panel);
        }

        private RibbonRowPanel CreateRibbonRowPanel(IEnumerable&amp;lt;RibbonCommandButton&amp;gt; buttons)
        {
            var rowPanel=new RibbonRowPanel();
            foreach (var btn in buttons)
            {
                rowPanel.Items.Add(btn);
            }
            return rowPanel;
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("MyRibbonTab")]
        public static void AddMyCustomRibbonTab()
        {
            try
            {
                var myRibbon= new MyRibbon();
                myRibbon.CreateMyTab();
            }
            catch (System.Exception ex)
            {
                CadApp.ShowAlertDialog($"Error:\n{ex.Message}");
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the picture showing the created ribbon tab:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="normanyuan_0-1735318220759.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1449430i1BADB73D995744B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normanyuan_0-1735318220759.png" alt="normanyuan_0-1735318220759.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 16:50:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13231853#M1359</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2024-12-27T16:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13232397#M1360</link>
      <description>&lt;P&gt;This worked but what I need is to set the property manually like Height, Width and position etc. But change in these properties doesn't effect at all.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 03:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13232397#M1360</guid>
      <dc:creator>luckyboy82292</dc:creator>
      <dc:date>2024-12-28T03:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13234158#M1361</link>
      <description>&lt;P&gt;Check out the official format for Autodesk Plugins (&lt;A href="https://help.autodesk.com/view/ACDLT/2024/ENU/?guid=GUID-40F5E92C-37D8-4D54-9497-CD9F0659F9BB" target="_blank" rel="noopener"&gt;.bundle&lt;/A&gt;&amp;nbsp;).&amp;nbsp; You can build the UI for your custom tools right in CAD with the CUI command and use the .cuix file for your UI, keeping it separate from your C#.&amp;nbsp; Super convenient and easy to manage.&amp;nbsp; There's nice extras, like you can assign Extended Help File custom .xaml to the buttons (in the cuix file) for fancy dropdown tooltips on hover that can include images, etc.&amp;nbsp; It's pretty nice, really.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 23:22:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13234158#M1361</guid>
      <dc:creator>Anthony_PungitoreJFMRZ</dc:creator>
      <dc:date>2024-12-29T23:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13239433#M1362</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13002699"&gt;@luckyboy82292&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;This worked but what I need is to set the property manually like Height, Width and position etc. But change in these properties doesn't effect at all.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The ribbon only supports predefined button sizes, but not custom sizes, so setting the height and width properties of a RibbonItem will not work. That applies to both custom ribbon content you create and add yourself via code, as well as ribbon content created using the CUI.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 18:42:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/13239433#M1362</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-01-02T18:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to arrange custom buttons in custom ribbon?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/14152427#M86908</link>
      <description>&lt;P&gt;MinWidth works&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 13:00:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-arrange-custom-buttons-in-custom-ribbon/m-p/14152427#M86908</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2026-06-03T13:00:04Z</dc:date>
    </item>
  </channel>
</rss>

