バージョン

ContentImage プロパティ

XamScreenTip のコンテンツ領域に関連付けされた画像を取得または設定します。デフォルト値は null です。
シンタックス
'宣言
 
Public Property ContentImage As ImageSource
public ImageSource ContentImage {get; set;}
解説

画像が指定される場合、マイクロソフトによって発行されている Office 2007 UI 設計ガイドラインで指定されているように XamRibbonScreenTip の合計幅は 318 ピクセルに設定されます。画像が指定されなければ、XamRibbonScreenTip の幅は 210 ピクセルに設定されます。

使用例
Private Sub addRibbonGroup()
    If xamRibbon.Tabs.Count < 1 Then
        Return
    End If
    Dim igTabItem As RibbonTabItem = xamRibbon.Tabs(0)
    'Add RibbonGroup
    Dim ribbonGroup As New RibbonGroup()
    ribbonGroup.Caption = "RibbonGroup Members"
    igTabItem.RibbonGroups.Add(ribbonGroup)
   
    'Add ButtonTool
    Dim btnToolRemoveFromQAT As ButtonTool = ButtonToolButtonToolButtonTool()
    btnToolRemoveFromQAT.Caption = "RemoveFromQAT"
   
    'Add ToolTip
    getRibbonScreenTip(btnToolRemoveFromQAT)
End Sub

'Create RibbonScreenTip
Private Sub getRibbonScreenTip(ByVal tool As ButtonTool)
    'Create XamRibbonScreenTip
    Dim ribbonScreenTip As New XamRibbonScreenTip()
    'XamRibbonScreenTip
    ribbonScreenTip.Header = "RibbonGroup.DialogBoxLauncherTool"
    ribbonScreenTip.Footer = "Press F1 for more help."
    ribbonScreenTip.Content = "The RibbonGroup.DialogBoxLauncherTool property has been set to a ButtonTool. You can right click on this tool to add it to the QAT."
    If ribbonScreenTip.HasContentImage = False Then
        ribbonScreenTip.ContentImage = getImageSource("images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png")
    End If
    ribbonScreenTip.FooterSeparatorVisibility = Visibility.Visible
    ribbonScreenTip.HeaderSeparatorVisibility = Visibility.Collapsed
   
    'Create FooterTemplate
   
    Dim template As New DataTemplate(GetType(StackPanel))
   
    'root element
    Dim elStackPanel As New FrameworkElementFactory(GetType(StackPanel))
    Dim mImageSource As ImageSource = getImageSource("images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png")
    Dim mImage As New Image()
    mImage.Source = mImageSource
   
    Dim bcGround As Brush = Brushes.Bisque
    elStackPanel.SetValue(StackPanel.OrientationProperty, Orientation.Vertical)
    elStackPanel.SetValue(StackPanel.BackgroundProperty, bcGround)
    elStackPanel.SetValue(StackPanel.WidthProperty, System.Convert.ToDouble(200))
    elStackPanel.SetValue(StackPanel.HeightProperty, System.Convert.ToDouble(200))
   
    'create child elements
    Dim elImage As New FrameworkElementFactory(GetType(Image))
    elImage.SetValue(Image.SourceProperty, mImageSource)
    elImage.SetValue(Image.WidthProperty, System.Convert.ToDouble(150))
    elImage.SetValue(Image.HeightProperty, System.Convert.ToDouble(150))
   
    elImage.SetBinding(Image.SourceProperty, New Binding("Source"))
   
    Dim elTextBlock As New FrameworkElementFactory(GetType(TextBlock))
    elTextBlock.SetValue(TextBlock.TextProperty, "Sample Text")
    elTextBlock.SetValue(TextBlock.WidthProperty, System.Convert.ToDouble(150))
    elTextBlock.SetValue(TextBlock.HeightProperty, System.Convert.ToDouble(150))
   
    'add child elements
   
    elStackPanel.AppendChild(elImage)
    elStackPanel.AppendChild(elTextBlock)
   
    template.VisualTree = elStackPanel
   
    'Create HeaderTemplate
    Dim template2 As New DataTemplate(GetType(TextBlock))
    Dim elTextBlock2 As New FrameworkElementFactory(GetType(TextBlock))
    elTextBlock2.SetValue(TextBlock.TextProperty, "Header Text")
    elTextBlock2.SetValue(TextBlock.WidthProperty, System.Convert.ToDouble(150))
    elTextBlock2.SetValue(TextBlock.HeightProperty, System.Convert.ToDouble(100))
    template2.VisualTree = elTextBlock2
   
    ribbonScreenTip.FooterTemplate = template
    ribbonScreenTip.HeaderTemplate = template2
    If TypeOf tool Is ButtonTool Then
        Dim btn As ButtonTool = TryCast(tool, ButtonTool)
        btn.ToolTip = ribbonScreenTip
    End If
End Sub
private void addRibbonGroup()
{
	if (xamRibbon.Tabs.Count < 1) { return; }
	RibbonTabItem igTabItem = xamRibbon.Tabs[0];
	//Add RibbonGroup
	RibbonGroup ribbonGroup = new  RibbonGroup();
	ribbonGroup.Caption = "RibbonGroup Members";
	igTabItem.RibbonGroups.Add(ribbonGroup);

	//Add ButtonTool
	ButtonTool btnToolRemoveFromQAT = ButtonToolButtonToolButtonTool();
	btnToolRemoveFromQAT.Caption = "RemoveFromQAT";

	//Add ToolTip
	getRibbonScreenTip(btnToolRemoveFromQAT);
} 

//Create RibbonScreenTip
private void getRibbonScreenTip(ButtonTool tool)
{
	//Create XamRibbonScreenTip
	XamRibbonScreenTip ribbonScreenTip = new XamRibbonScreenTip();
	//XamRibbonScreenTip
	ribbonScreenTip.Header = "RibbonGroup.DialogBoxLauncherTool";
	ribbonScreenTip.Footer = "Press F1 for more help.";
	ribbonScreenTip.Content = "The RibbonGroup.DialogBoxLauncherTool property has been set to a ButtonTool. You can right click on this tool to add it to the QAT.";
	if (ribbonScreenTip.HasContentImage == false)
	{
		ribbonScreenTip.ContentImage = getImageSource("images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png");
	}
	ribbonScreenTip.FooterSeparatorVisibility = Visibility.Visible;
	ribbonScreenTip.HeaderSeparatorVisibility = Visibility.Collapsed;

	//Create FooterTemplate
	
	DataTemplate template = new DataTemplate(typeof(StackPanel));

	//root element
	FrameworkElementFactory elStackPanel = new FrameworkElementFactory(typeof(StackPanel));
	ImageSource mImageSource = getImageSource("images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png");
	Image mImage = new Image();
	mImage.Source = mImageSource;

	Brush bcGround = Brushes.Bisque;
	elStackPanel.SetValue(StackPanel.OrientationProperty, Orientation.Vertical);
	elStackPanel.SetValue(StackPanel.BackgroundProperty, bcGround);
	elStackPanel.SetValue(StackPanel.WidthProperty, System.Convert.ToDouble(200));
	elStackPanel.SetValue(StackPanel.HeightProperty, System.Convert.ToDouble(200));

	//create child elements
	FrameworkElementFactory elImage = new FrameworkElementFactory(typeof(Image));
	elImage.SetValue(Image.SourceProperty, mImageSource);
	elImage.SetValue(Image.WidthProperty, System.Convert.ToDouble(150));
	elImage.SetValue(Image.HeightProperty, System.Convert.ToDouble(150));

	elImage.SetBinding(Image.SourceProperty, new Binding("Source"));

	FrameworkElementFactory elTextBlock = new FrameworkElementFactory(typeof(TextBlock));
	elTextBlock.SetValue(TextBlock.TextProperty, "Sample Text");
	elTextBlock.SetValue(TextBlock.WidthProperty, System.Convert.ToDouble(150));
	elTextBlock.SetValue(TextBlock.HeightProperty, System.Convert.ToDouble(150));

	//add child elements

	elStackPanel.AppendChild(elImage);
	elStackPanel.AppendChild(elTextBlock);

	template.VisualTree = elStackPanel;

	//Create HeaderTemplate
	DataTemplate template2 = new DataTemplate(typeof(TextBlock));
	FrameworkElementFactory elTextBlock2 = new FrameworkElementFactory(typeof(TextBlock));
	elTextBlock2.SetValue(TextBlock.TextProperty, "Header Text");
	elTextBlock2.SetValue(TextBlock.WidthProperty, System.Convert.ToDouble(150));
	elTextBlock2.SetValue(TextBlock.HeightProperty, System.Convert.ToDouble(100));
	template2.VisualTree = elTextBlock2;

	ribbonScreenTip.FooterTemplate = template;
	ribbonScreenTip.HeaderTemplate = template2;
	if (tool is ButtonTool)
	{
		ButtonTool btn = tool as ButtonTool;
		btn.ToolTip = ribbonScreenTip;
	}
}
<Window.Resources>
    
<!-- FooterTemplate -->
    
<DataTemplate x:Key="FooterTemplateWithHelpIcon">
        
<Grid>
            
<Grid.ColumnDefinitions>
                
<ColumnDefinition Width="Auto"/>
                
<ColumnDefinition Width="*"/>
            
</Grid.ColumnDefinitions>
            
<Image Grid.Column="0" Source="images\icons\Ribbon\Watermark.png"/>
            
<TextBlock Grid.Column="1" VerticalAlignment="Center"  Margin="9,0,0,0" 
            
FontWeight="Bold" Foreground="DimGray" 
            
Text="{Binding RelativeSource={RelativeSource FindAncestor,
            AncestorType={x:Type igWindows:XamScreenTip}}, Path=Footer}"/>

        
</Grid>
    
</DataTemplate>
    
<!-- FooterTemplate-end -->
</Window.Resources>

<!-- XamRibbonScreenTip -->
<igRibbon:XamRibbonScreenTip Header="RibbonGroup.DialogBoxLauncherTool"
    
Footer="Press F1 for more help." FooterSeparatorVisibility="Visible" 
    
Content="The RibbonGroup.DialogBoxLauncherTool property has been set 
    to a ButtonTool. You can right click on this tool to add it to the QAT."

    
FooterTemplate="{StaticResource FooterTemplateWithHelpIcon}"/>
<!-- XamRibbonScreenTip-end -->
参照