Jump to content
Sign in to follow this  
Andreik

Button size definition in ribbon xml

Recommended Posts

Andreik

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
Andreik

By the way, how could I obtain a button like Paste button from office.

15nsuic.png

All I tried I got nothing better than this dropdown button.

2lnfxpv.png


When the words fail... music speaks

Share this post


Link to post
Share on other sites
trancexx

Did you make it horizontal or vertical? I think it's horizontal by default.

What's the xml?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
trancexx

^^Yea I tried with four buttons and got pretty much the same as you showed on office pic.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
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
Sign in to follow this  

×