'宣言 Public Property TextPlacement As TextPlacement
public TextPlacement TextPlacement {get; set;}
Imports System Imports System.Windows Imports Infragistics.Windows.Ribbon Namespace MyNamespace Public Partial Class MyWindow Inherits XamRibbonWindow Public Sub New() InitializeComponent() End Sub Protected Sub LoadGalleryTool() Dim setting As New GalleryItemSettings() setting.TextDisplayMode = GalleryItemTextDisplayMode.Always setting.TextPlacement = TextPlacement.AboveImage setting.SelectionDisplayMode = GalleryItemSelectionDisplayMode.HighlightEntireItem setting.HorizontalTextAlignment = TextAlignment.Center setting.VerticalTextAlignment = VerticalAlignment.Top .... Dim item As New GalleryItem() item.Key = "Item10 item.Text = "Item10" item.Image = New BitmapImage(New Uri("\Images\ig_office_icon_16.png", UriKind.Relative)) item.Tag = "myTag" item.Settings = settings galleryTool.Items.Add(item) ..... End Sub End Class End Namespace
using System; using System.Windows; using Infragistics.Windows.Ribbon; namespace MyNamespace { public partial class MyWindow : XamRibbonWindow { public MyWindow() { InitializeComponent(); } protected void LoadGalleryTool() { GalleryItemSettings setting = new GalleryItemSettings(); setting.TextDisplayMode = GalleryItemTextDisplayMode.Always; setting.TextPlacement = TextPlacement.AboveImage; setting.SelectionDisplayMode = GalleryItemSelectionDisplayMode.HighlightEntireItem; setting.HorizontalTextAlignment = TextAlignment.Center; setting.VerticalTextAlignment = VerticalAlignment.Top; GalleryItem item = new GalleryItem(); item.Key = "Item10"; item.Text = "Item10"; item.Image = new BitmapImage(new Uri("\\Images\\ig_office_icon_16.png", UriKind.Relative)); item.Tag = "myTag"; item.Settings = settings; galleryTool.Items.Add(item); } } }