3

グループをレイアウトする場合、Windowsリボンフレームワークはいくつかの事前定義されたレイアウトをサポートします。4つのボタンを必要とするレイアウトの1つはと呼ばれFourButtonsます。

このレイアウトは、の3つの異なるサイズをサポートします。いずれの場合も、レイアウトを示します。

ここに画像の説明を入力してください

ここに画像の説明を入力してください

ここに画像の説明を入力してください

現在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レイアウトテンプレートを指定します。

そして私のレイアウトはFourButtonsです:

代替テキスト

FourButtonsレイアウトが必要ない場合を除いて、「 Four Buttons、Two BigTwoSmall」が必要です。

あるのと同じようにThreeButtons-OneBigAndTwoSmall

ここに画像の説明を入力してください

そして、ありますFiveButtons

ここに画像の説明を入力してください

FourButtons-TwoBigTwoSmall手動でモックアップできる、が必要です。

代替テキスト

残念ながら、Microsoftがカスタムレイアウトを作成するために発明した宣言型プログラミングは、プログラマーとして私を混乱させます。

誰かがページの下部にある宣言型言語の例を解読して、FourButton-TwoBigTwoSmallテンプレートを思い付くことができますか?

注:美しいグラフィック、フォーマット、リンクなどはすべて、光沢のあるグラフィックが大好きなリスを引き付けるために使用されます。そして、あなたが実際にここまで読んだら、私は実際にあなたの助けを使うことができます。

4

2 に答える 2

2

BigButtonsAndSmallButtonsOrInputsSizeDefinitionを使用する必要があります

例えば

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

グループのTab.ScalingPolicyにSize="Large"があるかどうかを確認してください。

于 2010-11-19T12:36:00.990 に答える
1

私は最終的にそれを理解しました。

1つはコントロールマップで、グループに(この場合は)4つのボタンがあることを義務付けています。に4つのエントリがあることにより、ControlNameMapこのサイズ定義を使用するグループには実際には4つのボタンがあることが義務付けられています。

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

4つのボタンにはエイリアスが与えられています。

  • 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つの大きなボタン、セパレーター、および別の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>

2つの大きなボタン、セパレーター、そして2つの行が発生します(各行には1つの小さなボタンが含まれます)。

小さなテンプレート:

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

それぞれに2つの小さなボタンの2つの行が表示されます。


すべてをまとめる:

<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>
于 2010-11-19T19:44:37.453 に答える