Windows 7 Ribbon: كيفية تحديد "أربعة أزرار ، اثنان كبير ، اثنان صغيران"؟

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

سؤال

عند وضع مجموعة ، يدعم إطار عمل Windows Ribbon بعض التخطيطات المحددة مسبقا. واحدة من التخطيطات التي تتطلب أربعة يسمى الأزرار 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 قالب تخطيط.

وتخطيطي هو Fourbuttons:

alt text

إلا أنني لا أريد Fourbuttons التصميم ، أريد "أربعة أزرار ، اثنان كبيران صغيران".

بنفس الطريقة التي يوجد 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>

ما عليك سوى التحقق ، إذا كانت مجموعتك تحتوي على حجم = "كبير" في علامة التبويب الخاصة بك. scalingpolicy.

نصائح أخرى

في النهاية اكتشفت ذلك.

الأول هو خريطة التحكم ، التي تفرض أن المجموعة لديها (في هذه الحالة) أربعة أزرار. من خلال وجود أربعة مشاركات في 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>

مما يسبب زرين كبيرتين ، فاصل ، واثنين من الأزرار الكبيرة الأخرى.

ال متوسط نموذج:

<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