Search code examples
windows-7ribbonwindows-ribbon-frameworkscenic-ribbonuiribbon

Windows 7 Ribbon: How to specify "Four buttons, two big, two small"?


When laying out a group, the Windows Ribbon Framework supports some predefined layouts. One of the layouts, which requires four buttons is called FourButtons.

This layout supports 3 different sizes, Large, Medium, and Small. In each case it gives the layouts:

Large:

enter image description here

Medium:

enter image description here

Small:

enter image description here

Right now i am using the FourButtons predefined template in my xml file as:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://schemas.microsoft.com/windows/2009/Ribbon">
   ...
   <Application.Views>
      <Ribbon>
         ...
         <Ribbon.Tabs>
            <Tab CommandName="tabHome">
               <Group CommandName="grpActivity" SizeDefinition="FourButtons">
                  <Button CommandName="cmdStartWorking" />
                  <Button CommandName="cmdStopWorking" />
                  <Button CommandName="cmdPrint" />
                  <Button CommandName="cmdDuplicateTicket" />
               </Group>
            </Tab>
         </Ribbon.Tabs>

      </Ribbon>
   </Application.Views>
</Application>

And you can see the line

<Group CommandName="grpActivity" SizeDefinition="FourButtons">

which specifies the FourButtons layout template.

And my layout is FourButtons:

alt text

Except i don't want FourButtons layout, i want "Four Buttons, Two Big Two Small".

In the same way that there is ThreeButtons-OneBigAndTwoSmall:

enter image description here

And there is a FiveButtons:

enter image description here

i want a FourButtons-TwoBigTwoSmall, which i can manually mockup:

alt text

Unfortunately declarative programming that Microsoft invented for creating custom layouts confounds me as a programmer.

Can anyone decipher the declarative language example at the bottom of the page and come up with a FourButton-TwoBigTwoSmall template?

Note: All the pretty graphics, formatting, links, and stuff are used to attract squirrels - who love shiny graphics. And if you actually read this far i could actually use your help.


Solution

  • you should use BigButtonsAndSmallButtonsOrInputs SizeDefinition

    e.g.

          <Group CommandName="cmdGroupBatch" SizeDefinition="BigButtonsAndSmallButtonsOrInputs">
            <ControlGroup>
              <Button CommandName="cmdButtonGetBatch" />
              <Button CommandName="cmdButtonPutBatch" />
            </ControlGroup>
            <ControlGroup>
              <Button CommandName="cmdButtonSaveBatch" />
              <Button CommandName="cmdButtonDiscartBatch" />
            </ControlGroup>
          </Group>
    

    Just check, if your Group has Size="Large" in your Tab.ScalingPolicy.