バージョン

GetMinimumSize メソッド

RibbonGroup に表示される時に、ツールの最大サイズを決定する MinimumSize 添付の依存プロパティの値を取得します。
シンタックス
'宣言
 
Public Shared Function GetMinimumSize( _
   ByVal d As DependencyObject _
) As RibbonToolSizingMode
public static RibbonToolSizingMode GetMinimumSize( 
   DependencyObject d
)

パラメータ

d
解説

MinimumSize は、RibbonGroup 内のツールのサイズを決定する時、Variants および MaximumSizeProperty と連動して使用されます。MinimumSize は、ツールが縮小される最小サイズを示します。ImageAndTextLarge の値は、ツールが大きなツールとして常に表示されることを保証するために使用されます。つまり、ツールは常に RibbonGroup の最大の高さにわたります。ImageAndTextNormal の値は、ツールのキャプションが常に表示されることを保証するために使用されます。ImageOnly の値は、キャプションが非表示にされるなどのツールがサイズ変更できることを示すために使用されます。これは、エンド ユーザーがツールの機能を識別するために十分なコンテキストをツールの画像が提供する場合によく使用されます。

この値は主にグループの Variants コレクションからの GroupVariant が処理され、GroupVariant が ReduceImageAndTextLargeTools または ReduceImageAndTextNormalTools の ResizeAction を持つ場合に使用されます。

使用例
'Add RibbonGroup and set it properties
Private Sub addRibbonGroupProperties()
    If xamRibbon.Tabs.Count < 1 Then
        Return
    End If
    Dim igTabItem As RibbonTabItem = xamRibbon.Tabs(0)
    'Create RibbonGroup
    Dim ribbonGroup As RibbonGroup = getRibbonGroup(igTabItem, "RibbonGroup Members")
   
    'RibbonGroup properties
    RibbonGroup.SetMaximumSize(ribbonGroup, RibbonToolSizingMode.ImageAndTextLarge)
    RibbonGroup.SetMinimumSize(ribbonGroup, RibbonToolSizingMode.ImageOnly)
    ribbonGroup.MaxWidth = 400
    ribbonGroup.MinWidth = 200
    ribbonGroup.Id = "mRibbonGroup"
    ribbonGroup.KeyTip = "RK1"
    ribbonGroup.IsOpen = True
    ribbonGroup.SmallImage = getImageSource("/images/icons/Ribbon/Paste_32x32.png")
   
    'RibbonGroup events
    AddHandler ribbonGroup.Closed, AddressOf ribbonGroup_Closed
    AddHandler ribbonGroup.Opening, AddressOf ribbonGroup_Opening
    AddHandler ribbonGroup.Opened, AddressOf ribbonGroup_Opened
    'add tools to RibbonGroup
   
    Dim btnToolAddToQAT As ButtonTool = addButtonToolToRibbonGroup(ribbonGroup, "AddToQAT", "btnAddToQAT", "/images/icons/Ribbon/New_Large.png")
    Dim btnToolRemoveFromQAT As ButtonTool = addButtonToolToRibbonGroup(ribbonGroup, "RemoveFromQAT", "btnToolRemoveFromQAT", "/images/icons/Ribbon/Open_Large.png")
    AddHandler btnToolAddToQAT.Click, AddressOf btnToolAddToQAT_Click
   
    'Add DialogBoxLauncherTool
    ribbonGroup.DialogBoxLauncherTool = btnToolRemoveFromQAT
   
    'Add ToolTip
    getRibbonScreenTip(btnToolRemoveFromQAT)
End Sub

Private Function getRibbonGroup(ByVal igTabItem As RibbonTabItem, ByVal ribbonGroupCaption As String) As RibbonGroup
    Dim ribbonGroup As New RibbonGroup()
    ribbonGroup.Caption = ribbonGroupCaption
    Dim toolHorizontalWrapPanel As New ToolHorizontalWrapPanel()
    ribbonGroup.Items.Add(toolHorizontalWrapPanel)
    igTabItem.RibbonGroups.Add(ribbonGroup)
    Return ribbonGroup
End Function

'Add ButtonTool to RibbonGroup
Private Function addButtonToolToRibbonGroup(ByVal igRibbongroup As RibbonGroup, ByVal caption As String, ByVal tagString As String, ByVal imageUriString As String) As ButtonTool
    Dim btnTool As ButtonTool = getButtonTool(caption, tagString, imageUriString)
    igRibbongroup.Items.Add(btnTool)
    Return btnTool
End Function

'get ButtonTool
Private Function getButtonTool(ByVal caption As String, ByVal tagString As String, ByVal imageUriString As String) As ButtonTool
    Dim btnTool As New ButtonTool()
    btnTool.Caption = caption
    btnTool.Tag = tagString
    btnTool.LargeImage = getImageSource(imageUriString)
    Return btnTool
End Function

'Get Image Source
Private Function getImageSource(ByVal uriString As String) As BitmapImage
    Dim bmpImage As New BitmapImage()
    bmpImage.BeginInit()
    bmpImage.UriSource = New Uri(uriString, UriKind.RelativeOrAbsolute)
    bmpImage.EndInit()
    Return bmpImage
End Function
//Add RibbonGroup and set it properties
private void addRibbonGroupProperties()
{
	if (xamRibbon.Tabs.Count < 1) { return; }
	RibbonTabItem igTabItem = xamRibbon.Tabs[0];
	//Create RibbonGroup
	RibbonGroup ribbonGroup = getRibbonGroup(igTabItem, "RibbonGroup Members");

	//RibbonGroup properties
	RibbonGroup.SetMaximumSize(ribbonGroup, RibbonToolSizingMode.ImageAndTextLarge);
	RibbonGroup.SetMinimumSize(ribbonGroup, RibbonToolSizingMode.ImageOnly);
	ribbonGroup.MaxWidth = 400;
	ribbonGroup.MinWidth = 200;
	ribbonGroup.Id = "mRibbonGroup";
	ribbonGroup.KeyTip = "RK1";
	ribbonGroup.IsOpen = true;
	ribbonGroup.SmallImage = getImageSource("/images/icons/Ribbon/Paste_32x32.png");

	//RibbonGroup events
	ribbonGroup.Closed += new RoutedEventHandler(ribbonGroup_Closed);
	ribbonGroup.Opening += new EventHandler<Infragistics.Windows.Ribbon.Events.RibbonGroupOpeningEventArgs>(ribbonGroup_Opening);
	ribbonGroup.Opened += new RoutedEventHandler(ribbonGroup_Opened);
	//add tools to RibbonGroup

	ButtonTool btnToolAddToQAT = addButtonToolToRibbonGroup(ribbonGroup, "AddToQAT", "btnAddToQAT", "/images/icons/Ribbon/New_Large.png");
	ButtonTool btnToolRemoveFromQAT = addButtonToolToRibbonGroup(ribbonGroup, "RemoveFromQAT", "btnToolRemoveFromQAT", "/images/icons/Ribbon/Open_Large.png");
	btnToolAddToQAT.Click += new RoutedEventHandler(btnToolAddToQAT_Click);

	//Add DialogBoxLauncherTool
	ribbonGroup.DialogBoxLauncherTool = btnToolRemoveFromQAT;

	//Add ToolTip
	getRibbonScreenTip(btnToolRemoveFromQAT);
}

private RibbonGroup getRibbonGroup(RibbonTabItem igTabItem, string ribbonGroupCaption)
{
	RibbonGroup ribbonGroup = new RibbonGroup();
	ribbonGroup.Caption = ribbonGroupCaption;
	ToolHorizontalWrapPanel toolHorizontalWrapPanel = new ToolHorizontalWrapPanel();
	ribbonGroup.Items.Add(toolHorizontalWrapPanel);
	igTabItem.RibbonGroups.Add(ribbonGroup);
	return ribbonGroup;
}

//Add ButtonTool to RibbonGroup
private ButtonTool addButtonToolToRibbonGroup(RibbonGroup igRibbongroup, string caption, string tagString, string imageUriString)
{
	ButtonTool btnTool = getButtonTool(caption, tagString, imageUriString);
	igRibbongroup.Items.Add(btnTool);
	return btnTool;
}

//get ButtonTool
private ButtonTool getButtonTool(string caption, string tagString, string imageUriString)
{
	ButtonTool btnTool = new ButtonTool();
	btnTool.Caption = caption;
	btnTool.Tag = tagString;
	btnTool.LargeImage = getImageSource(imageUriString);
	return btnTool;
}

//Get Image Source
private BitmapImage getImageSource(string uriString)
{
	BitmapImage bmpImage = new BitmapImage();
	bmpImage.BeginInit();
	bmpImage.UriSource = new Uri(uriString, UriKind.RelativeOrAbsolute);
	bmpImage.EndInit();
	return bmpImage;
}
<igRibbon:RibbonGroup Name="VariantsGroup1" Caption="VariantsGroup1" 
    
MaxWidth="600" MaxHeight="150" MinWidth="150" MinHeight="100"
    
KeyTip="RG1" Id="R1" SmallImage="Images\icons\Ribbon\LeftAlign.png"
    
igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge" 
    
igRibbon:RibbonGroup.MinimumSize="ImageOnly" >
    
<!--GroupVariants-->
    
<igRibbon:RibbonGroup.Variants>
        
<igRibbon:GroupVariant Priority="5" ResizeAction="HideGalleryPreview" />
        
<igRibbon:GroupVariant Priority="10" ResizeAction="ReduceGalleryPreviewItems" />
        
<igRibbon:GroupVariant Priority="30" ResizeAction="ReduceImageAndTextLargeTools" />
        
<igRibbon:GroupVariant Priority="20" ResizeAction="ReduceImageAndTextNormalTools" />
        
<igRibbon:GroupVariant Priority="35" ResizeAction="ReduceHorizontalWrapRowCount" />
        
<igRibbon:GroupVariant Priority="40" ResizeAction="CollapseRibbonGroup" />
    
</igRibbon:RibbonGroup.Variants>
    
<!--GroupVariants-end-->
    
<!--RibbonGroup.Items-->
    
<igRibbon:MenuTool igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge" ButtonType="Segmented"  
              
Caption="MenuTool Mixed" 
              
LargeImage="Images\icons\Ribbon\Paste_32x32.png" SmallImage="Images\icons\Ribbon\Paste_16x16.png" 
              
HorizontalAlignment="Left" >
        
<igRibbon:CheckBoxTool Caption="XamRibbon CheckBox Tool" 
            
SmallImage="Images\icons\Ribbon\BlueQuestionMark.png"/>
        
<igRibbon:ButtonTool  Caption="Button in MenuTool1" 
            
LargeImage="Images\icons\Ribbon\32x32.png" SmallImage="Images\icons\Ribbon\16x16.png"/>
        
<igRibbon:ButtonTool  Caption="Button in MenuTool2" 
            
LargeImage="Images\icons\Ribbon\Paste_32x32.png" SmallImage="Images\icons\Ribbon\Paste_16x16.png"/>
    
</igRibbon:MenuTool>

    
<igRibbon:MenuTool igRibbon:RibbonGroup.MaximumSize="ImageAndTextNormal" ButtonType="SegmentedState"  
              
Caption="MenuTool Min3" 
              
LargeImage="Images\icons\Ribbon\Paste_32x32.png" SmallImage="Images\icons\Ribbon\Paste_16x16.png" 
              
HorizontalAlignment="Left" >
        
<igRibbon:CheckBoxTool Caption="XamRibbon CheckBox Tool" 
            
SmallImage="Images\icons\Ribbon\EditUndo.png"/>
        
<igRibbon:ButtonTool Caption="Button in MenuTool1" 
            
LargeImage="Images\icons\Ribbon\32x32.png" SmallImage="Images\icons\Ribbon\16x16.png"/>
        
<igRibbon:ButtonTool Caption="Button in MenuTool2" 
            
LargeImage="Images\icons\Ribbon\Paste_32x32.png" SmallImage="Images\icons\Ribbon\Paste_16x16.png"/>
    
</igRibbon:MenuTool>
    
<!--RibbonGroup.Items-end-->
</igRibbon:RibbonGroup>
参照