Jump to content

Button size definition in ribbon xml


Andreik
 Share

Recommended Posts

I am working to create the design of a ribbon menu and I don't know how could I set the size of my buttons something like 64x64 instead of 32x32.

Right now my button is defined in xml like so:

 

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://schemas.microsoft.com/windows/2009/Ribbon">
  <Application.Commands>
      <Command Name="Tab2" Id="2" LabelTitle="Collection" LabelDescription="" TooltipTitle="Collection" TooltipDescription="" Keytip="C" />
        <Command Name="Group2" Id="7" LabelTitle="Collection" LabelDescription="" TooltipTitle="Collection" TooltipDescription="" Keytip="CC" />
        <Command Name="Button2" Id="22" LabelTitle="New" LabelDescription="" TooltipTitle="New" TooltipDescription="" Keytip="CCN">
            <Command.LargeImages>
                <Image Source="C:MiscIcocollection_new.bmp" />
            </Command.LargeImages>
        </Command>
    </Application.Commands>
    <Application.Views>
        <Ribbon>
            <Ribbon.Tabs>
                <Tab CommandName="Tab2">
                    <Group CommandName="Group2" SizeDefinition="OneButton">
                        <Button CommandName="Button2" />
                    </Group>
                </Tab>
            </Ribbon.Tabs>
        </Ribbon>
    </Application.Views>
</Application>

 

How could I set the size of a button when I design it in xml?

When the words fail... music speaks.

Link to comment
Share on other sites

I'm not sure you can do that, with ribbons it's all about ratios and relations. What you can though, is specify the size of your button compared wit other buttons in group (which you don't have :D).

Read this.

 

That means you can do this:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://schemas.microsoft.com/windows/2009/Ribbon">
  <Application.Commands>
    <Command Name="Tab2" Id="2" LabelTitle="Collection" LabelDescription="" TooltipTitle="Collection" TooltipDescription="" Keytip="C" />
    <Command Name="Group2" Id="7" LabelTitle="Collection" LabelDescription="" TooltipTitle="Collection" TooltipDescription="" Keytip="CC" />
    <Command Name="Button2" Id="22" LabelTitle="New" LabelDescription="" TooltipTitle="New" TooltipDescription="" Keytip="CCN">
      <Command.LargeImages>
        <Image Source="C:\Misc\Ico\collection_new.bmp" />
      </Command.LargeImages>
    </Command>
    <Command Name="Button2x" Id="23" LabelTitle="Old" LabelDescription="" TooltipTitle="Aah" TooltipDescription="" Keytip="CCNx">
      <Command.LargeImages>
        <Image Source="C:\Misc\Ico\collection_new.bmp" />
      </Command.LargeImages>
    </Command>
    <Command Name="Button2y" Id="24" LabelTitle="Whatever" LabelDescription="" TooltipTitle="Bzz" TooltipDescription="" Keytip="CCNy">
      <Command.LargeImages>
        <Image Source="C:\Misc\Ico\collection_new.bmp" />
      </Command.LargeImages>
    </Command>
  </Application.Commands>
  <Application.Views>
    <Ribbon>
      <Ribbon.Tabs>
        <Tab CommandName="Tab2">

          <Tab.ScalingPolicy>
            <ScalingPolicy>
              <ScalingPolicy.IdealSizes>
                <Scale Group="Group2" Size="Small" />
              </ScalingPolicy.IdealSizes>
            </ScalingPolicy>
          </Tab.ScalingPolicy>

          <Group CommandName="Group2" SizeDefinition="ThreeButtons-OneBigAndTwoSmall">
            <Button CommandName="Button2" />
            <Button CommandName="Button2x" />
            <Button CommandName="Button2y" />
          </Group>
        </Tab>
      </Ribbon.Tabs>
    </Ribbon>
  </Application.Views>
</Application>
Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I used just SizeDefinition for groups and the buttons are displayed as I want in layout and at your suggestion I tried ScalingPolicy small/large but without any visible modification. Maybe my eyes are weak but I see the buttons too small. :geek:

When the words fail... music speaks.

Link to comment
Share on other sites

I couldn't find any property to set it on vertical or horizontal, it's default.

Here's the xml:

<?xml version="1.0" encoding="utf-8"?>
<!--Created with RibbonMarkupCreator, to be found at http://sites.google.com/site/huyvantan/start/my-programs/ribbonmarkupcreator/-->
<Application xmlns="http://schemas.microsoft.com/windows/2009/Ribbon">
  <Application.Commands>
    <Command Name="AppMenu" Id="59999" LabelTitle="Application Menu" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="M" />
    <Command Name="Tab1" Id="2" LabelTitle="Test" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="" />
    <Command Name="Group1" Id="3" LabelTitle="MyGroup" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="" />
    <Command Name="SplitButton1" Id="6" LabelTitle="Main Button" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="" />
    <Command Name="Button1" Id="4" LabelTitle="First Button" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="" />
    <Command Name="Button2" Id="5" LabelTitle="Second Button" LabelDescription="" TooltipTitle="" TooltipDescription="" Keytip="" />
    <Command Name="QuickAccessToolbar" Id="59998" />
    <Command Name="HelpButton" />
  </Application.Commands>
  <Application.Views>
    <Ribbon>
      <Ribbon.QuickAccessToolbar>
        <QuickAccessToolbar CommandName="QuickAccessToolbar" />
      </Ribbon.QuickAccessToolbar>
      <Ribbon.ApplicationMenu>
        <ApplicationMenu CommandName="AppMenu" />
      </Ribbon.ApplicationMenu>
      <Ribbon.HelpButton>
        <HelpButton CommandName="HelpButton" />
      </Ribbon.HelpButton>
      <Ribbon.Tabs>
        <Tab CommandName="Tab1">
          <Group CommandName="Group1" SizeDefinition="OneButton">
            <SplitButton CommandName="SplitButton1">
              <Button CommandName="Button1" />
              <Button CommandName="Button2" />
            </SplitButton>
          </Group>
        </Tab>
      </Ribbon.Tabs>
    </Ribbon>
  </Application.Views>
</Application>

LE: I got it with SizeDefinition (check XML) looking like here

11tsqi0.png

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Those SplitButtons have always the text of one subitem? As you can see in my above post image, even if the label name of the split buton is "Main Button" in ribbon is displayed the text of the first button.

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...