技术开发 频道

VS与Win7共舞:用XML文件定义Ribbon界面

  首先我们在XML文件的命令部分(Commands)添加相应的控件描述:

<Application.Commands>
    
<!--Tab页面-->
    
<Command Name="TabHome" Symbol="cmdTabHome" Id="30000" LabelTitle="主页" />
    
<!--主要分组-->
    
<Command Name="GroupMain" Symbol="cmdGroupMain" Id="30001" LabelTitle="组控件"/>
    
<Command Name="MyButton" Symbol="cmdMyButton" Id="30002" LabelTitle="按钮控件">
      
<Command.TooltipTitle>按钮控件</Command.TooltipTitle>
      
<Command.TooltipDescription>点击这个按钮控件,获得当前系统时间。</Command.TooltipDescription>
      
<Command.LargeImages>
        
<Image Source="Button_Image.bmp"/>
      
</Command.LargeImages>
      
<Command.SmallImages>
        
<Image Source="Button_Image.bmp"/>
      
</Command.SmallImages>
    
</Command>
    
<!--数据库组-->
    
<Command Name="GroupDatabase" Symbol="cmdGroupDatabase" Id="30004">
      
<Command.LabelTitle>Database</Command.LabelTitle>
    
</Command>
    
<!--数据库组按钮控件-->
    
<Command Name="AddTable" Symbol="cmdAddTable" Id="30006"
    LabelTitle
="Add Table">
      
<Command.TooltipTitle>Add Table</Command.TooltipTitle>
      
<Command.TooltipDescription>Add Table</Command.TooltipDescription>
      
<Command.LargeImages>
        
<Image Source="AddTableL.bmp"/>
      
</Command.LargeImages>
      
<Command.SmallImages>
        
<Image Source="AddTableS.bmp"/>
      
</Command.SmallImages>
    
</Command>
    
<Command Name="DeleteTable" Symbol="cmdDeleteTable" Id="30007" LabelTitle="Delete Table">
      
<Command.TooltipTitle>Delete Table</Command.TooltipTitle>
      
<Command.TooltipDescription>Delete Table</Command.TooltipDescription>
      
<Command.LargeImages>
        
<Image Source="DeleteTableL.bmp"/>
      
</Command.LargeImages>
      
<Command.SmallImages>
        
<Image Source="DeleteTableS.bmp"/>
      
</Command.SmallImages>
    
</Command>
    
<Command Name="PrintRelationships" Symbol="cmdPrintRelationships" Id="30008" LabelTitle="Print Relationships">
      
<Command.TooltipTitle>Print Relationships</Command.TooltipTitle>
      
<Command.TooltipDescription>Print Relationships</Command.TooltipDescription>
      
<Command.LargeImages>
        
<Image Source="PrintRelationshipsL.bmp"/>
      
</Command.LargeImages>
      
<Command.SmallImages>
        
<Image Source="PrintRelationshipsS.bmp"/>
      
</Command.SmallImages>
    
</Command>
    
<!--剪切板组-->
    
<Command Name="GroupClipboard" Symbol="cmdGroupClipboard" Id="30005">
      
<Command.LabelTitle>Clipboard</Command.LabelTitle>
      
<!--定义剪切板组的图标,用于在剪切板处于Popup模式时显示-->
      
<Command.LargeImages>
        
<Image Source="Paste.bmp"/>
      
</Command.LargeImages>
    
</Command>
    
<!--剪切板组按钮控件-->
    
<Command Name="Paste" Symbol="cmdPaste" Id="30009" LabelTitle="Paste">
      
<Command.TooltipTitle>Paste</Command.TooltipTitle>
      
<Command.TooltipDescription>Paste</Command.TooltipDescription>
      
<Command.LargeImages>
        
<Image Source="Paste.bmp"/>
      
</Command.LargeImages>
    
</Command>
    
<Command Name="Cut" Symbol="cmdCut" Id="30010" LabelTitle="Cut">
      
<Command.TooltipTitle>Cut</Command.TooltipTitle>
      
<Command.TooltipDescription>Cut</Command.TooltipDescription>
      
<Command.SmallImages>
        
<Image Source="Cut.bmp"/>
      
</Command.SmallImages>
    
</Command>
    
<Command Name="Copy" Symbol="cmdCopy" Id="30011" LabelTitle="Copy">
      
<Command.TooltipTitle>Copy</Command.TooltipTitle>
      
<Command.TooltipDescription>Copy</Command.TooltipDescription>
      
<Command.SmallImages>
        
<Image Source="Copy.bmp"/>
      
</Command.SmallImages>
    
</Command>
1
相关文章