Лента Windows 7: Как указать «Четыре кнопки, два больших, два маленьких»?

StackOverflow https://stackoverflow.com/questions/3407079

Вопрос

При выкладывании группы поддерживает рамочную структуру Windows ленты Некоторые заранее определенные макеты. Отказ Один из макетов, которые требуют четыре Кнопки называются FourButtons.

Этот макет поддерживает 3 разных размера, Большой, Середина, а также Небольшой. Отказ В каждом случае это дает макеты:

Большой:

enter image description here

Середина:

enter image description here

Небольшой:

enter image description here

Прямо сейчас я использую FourButtons предопределенный шаблон в моем XML-файле как:

<?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>

И вы можете увидеть линию

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

который указывает FourButtons Шаблон макета.

И моя макет Четырехбуттоны:

alt text

Кроме я не хочу Четырехбуттоны Макет, я хочу "Четыре кнопки, два больших двух маленьких".

Таким же образом, что есть ThreeButtons-OneBigAndTwoSmall:

enter image description here

И есть FiveButtons:

enter image description here

я хочу FourButtons-TwoBigTwoSmall, который я могу вручную макет:

alt text

К сожалению декларативное программирование что Microsoft изобрел для создания пользовательских макетов Смущает меня как программист.

Может ли кто-нибудь расшифровать декларативный язык языка в нижней части страницы и придумал FourButton-Twobigtwosmall. шаблон?

Примечание: Вся красивая графика, форматирование, ссылки и вещи используются для привлечения белок - которые любят блестящие графики. И если вы на самом деле прочитаете это далеко, я мог фактически Используйте свою помощь.

Это было полезно?

Решение

Вы должны использовать BigButtonsandsmallbuttonsorInputs. Размер определения

например

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

Просто проверьте, если ваша группа имеет размер = «большой» на вашей вкладке. PSCAlingPolicy.

Другие советы

Я в конечном итоге выяснил это.

Во-первых, это карта управления, которая мамает, что группа имеет (в данном случае) четыре кнопки. Имея четыре записи в ControlNameMap Мы марипитаем, что группа, использующая это определение размера, на самом деле имеет четыре кнопки.

<ControlNameMap>
   <ControlNameDefinition Name="button1"/>
   <ControlNameDefinition Name="button2"/>
   <ControlNameDefinition Name="button3"/>
   <ControlNameDefinition Name="button4"/>
</ControlNameMap>

Четыре кнопки приведены псевдонимы:

  • button1
  • button2
  • button3
  • button4

Так что их можно ссылаться в определения, чтобы следовать. Во-первых, то Большой шаблон:

<GroupSizeDefinition Size="Large">
    <ControlSizeDefinition ControlName="button1" ImageSize="Large" IsLabelVisible="true" />
    <ControlSizeDefinition ControlName="button2" ImageSize="Large" IsLabelVisible="true" />
    <ColumnBreak ShowSeparator="true"/>
    <ControlSizeDefinition ControlName="button3" ImageSize="Large" IsLabelVisible="true" />
    <ControlSizeDefinition ControlName="button4" ImageSize="Large" IsLabelVisible="true" />
</GroupSizeDefinition>

Что вызывает две большие кнопки, сепаратор и еще 2 больших кнопки.

То Средняя шаблон:

<GroupSizeDefinition Size="Medium">
    <ControlSizeDefinition ControlName="button1" ImageSize="Large" IsLabelVisible="true" />
    <ControlSizeDefinition ControlName="button2" ImageSize="Large" IsLabelVisible="true" />
    <ColumnBreak ShowSeparator="true"/>
    <Row>
        <ControlSizeDefinition ControlName="button3" ImageSize="Small" IsLabelVisible="true" />
    </Row>
    <Row>
        <ControlSizeDefinition ControlName="button4" ImageSize="Small" IsLabelVisible="true" />
    </Row>
</GroupSizeDefinition>

Вызывает две большие кнопки, сепаратор, а затем два ряда (с каждой строкой, содержащей одну маленькую кнопку).

То небольшой шаблон:

<GroupSizeDefinition Size="Small">
    <Row>
        <ControlSizeDefinition ControlName="button1" ImageSize="Small" IsLabelVisible="true" />
        <ControlSizeDefinition ControlName="button3" ImageSize="Small" IsLabelVisible="false" />
    </Row>
    <Row>
        <ControlSizeDefinition ControlName="button2" ImageSize="Small" IsLabelVisible="true" />
        <ControlSizeDefinition ControlName="button4" ImageSize="Small" IsLabelVisible="false" />
    </Row>
</GroupSizeDefinition>

Заставляет два ряда из двух маленьких кнопок в каждой, чтобы появиться.


Принося все это вместе:

<Group CommandName="grpActivity" >
    <SizeDefinition>
        <ControlNameMap>
            <ControlNameDefinition Name="button1"/>
            <ControlNameDefinition Name="button2"/>
            <ControlNameDefinition Name="button3"/>
            <ControlNameDefinition Name="button4"/>
        </ControlNameMap>
        <GroupSizeDefinition Size="Large">
            <ControlSizeDefinition ControlName="button1" ImageSize="Large" IsLabelVisible="true" />
            <ControlSizeDefinition ControlName="button2" ImageSize="Large" IsLabelVisible="true" />
            <ColumnBreak ShowSeparator="true"/>
            <ControlSizeDefinition ControlName="button3" ImageSize="Large" IsLabelVisible="true" />
            <ControlSizeDefinition ControlName="button4" ImageSize="Large" IsLabelVisible="true" />
        </GroupSizeDefinition>
        <GroupSizeDefinition Size="Medium">
            <ControlSizeDefinition ControlName="button1" ImageSize="Large" IsLabelVisible="true" />
            <ControlSizeDefinition ControlName="button2" ImageSize="Large" IsLabelVisible="true" />
            <ColumnBreak ShowSeparator="true"/>
            <Row>
                <ControlSizeDefinition ControlName="button3" ImageSize="Small" IsLabelVisible="true" />
            </Row>
            <Row>
                <ControlSizeDefinition ControlName="button4" ImageSize="Small" IsLabelVisible="true" />
            </Row>
        </GroupSizeDefinition>
        <GroupSizeDefinition Size="Small">
            <Row>
                <ControlSizeDefinition ControlName="button1" ImageSize="Small" IsLabelVisible="true" />
                <ControlSizeDefinition ControlName="button3" ImageSize="Small" IsLabelVisible="false" />
            </Row>
            <Row>
                <ControlSizeDefinition ControlName="button2" ImageSize="Small" IsLabelVisible="true" />
                <ControlSizeDefinition ControlName="button4" ImageSize="Small" IsLabelVisible="false" />
            </Row>
        </GroupSizeDefinition>
    </SizeDefinition>

    <Button CommandName="cmdStartWorking" />
    <Button CommandName="cmdStopWorking" />
    <Button CommandName="cmdPrint" />
    <Button CommandName="cmdDuplicateTicket" />
</Group>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top