InlineUIContainer 類別

定義

提供內嵌內容專案,可讓 UIElement 類型內嵌在 RichTextBlock的內容中。

public ref class InlineUIContainer sealed : Inline
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="Child")]
class InlineUIContainer final : Inline
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="Child")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class InlineUIContainer final : Inline
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="Child")]
public sealed class InlineUIContainer : Inline
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="Child")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class InlineUIContainer : Inline
Public NotInheritable Class InlineUIContainer
Inherits Inline
<InlineUIContainer .../>
-or-
<InlineUIContainer ...>
  singleChild
</InlineUIContainer>

繼承
Object Platform::Object IInspectable DependencyObject TextElement Inline InlineUIContainer
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

下列程式碼範例示範如何使用 InlineUIContainer 將影像插入 RichTextBlock

<RichTextBlock>
    <Paragraph>
        <Italic>This is an inline image.</Italic>

        <InlineUIContainer>
            <Image Source="Assets/SmallLogo.png" Height="30" Width="30"/>
        </InlineUIContainer>

        Mauris auctor tincidunt auctor.
    </Paragraph>
</RichTextBlock>

備註

使用 InlineUIContainer 物件的最常見案例是將影像導入文字內容。 使用影像的新 Image 物件作為 InlineUIContainer 的子內容。 如果您不想將 高度 和寬度調整為自然影像大小,請在影像上設定高度和 寬度

如果您想要將多個元素內嵌在同一個位置,請考慮使用面板作為單一 InlineUIContainer 子系,然後將多個元素放在該面板中。

如果放在 InlineUIContainer 中,可以專注的控制項仍會出現在最上層索引標籤序列中。

如果您想要互動式文字,請考慮使用 Hyperlink 元素 (一種 內嵌) 類型,而不是使用 InlineUIContainer 搭配 Button 或類似的 按鈕 。 請參閱 連結的指導方針

InlineUIContainer 會繼承 TextElement 類別的屬性。 不過,其中大部分的屬性都沒有任何可見的效果。 您最常在 XAML 中宣告 InlineUIContainer 物件元素,而不需設定任何屬性 (除了 x:Name 屬性) 內嵌為 InlineUIContainer 物件元素內容的單一子項目之外。

在 InlineUIContainer 上設定屬性,否則會影響 text 元素的字元行高度 (,例如 FontSizeFontFamily) 不會影響轉譯和外觀。 內容會指定其大小和 InlineUIContainer 大小以符合其大小。

如果子 (內容中有進一步的文字,例如 TextBlock.Text 或其他巢狀 RichTextBlock 內的文字元素,) InlineUIContainer 父系的 text 元素屬性將不會繼承到內容中,則會忽略這些文字。

建構函式

InlineUIContainer()

初始化 InlineUIContainer 類別的新實例。

屬性

AccessKey

取得或設定這個專案的存取索引鍵。

(繼承來源 TextElement)
AccessKeyScopeOwner

取得或設定提供這個專案存取索引鍵範圍的來源專案,即使它不在來源專案的視覺化樹狀結構中也一樣。

(繼承來源 TextElement)
AllowFocusOnInteraction

取得或設定值,這個值表示當使用者與其互動時,專案是否會自動取得焦點。

(繼承來源 TextElement)
CharacterSpacing

取得或設定字元之間的統一間距,單位為 em 的 1/1000。

(繼承來源 TextElement)
Child

取得或設定InlineUIContainer所裝載的UIElement

ContentEnd

取得 TextPointer ,表示 專案中內容的結尾。

(繼承來源 TextElement)
ContentStart

取得 TextPointer ,表示 元素中內容的開頭。

(繼承來源 TextElement)
Dispatcher

取得這個 物件相關聯的 CoreDispatcherCoreDispatcher代表可在 UI 執行緒上存取DependencyObject的功能,即使程式碼是由非 UI 執行緒起始也一樣。

(繼承來源 DependencyObject)
ElementEnd

取得 TextPointer ,表示緊接在專案結尾之後的位置。

(繼承來源 TextElement)
ElementStart

取得 TextPointer ,表示元素開頭之前的位置。

(繼承來源 TextElement)
ExitDisplayModeOnAccessKeyInvoked

取得或設定值,這個值會指定叫用存取金鑰時,是否關閉存取金鑰顯示。

(繼承來源 TextElement)
FontFamily

取得或設定項目內容慣用的最上層字型家族。

(繼承來源 TextElement)
FontSize

取得或設定項目內容的字型大小。

(繼承來源 TextElement)
FontStretch

取得或設定要選取之系列中字型的字元寬度。

(繼承來源 TextElement)
FontStyle

取得或設定這個專案中內容的字型樣式。

(繼承來源 TextElement)
FontWeight

取得或設定要從此元素內容之字型系列中選取的最上層字型粗細。

(繼承來源 TextElement)
Foreground

取得或設定要套用至這個專案中內容的 Brush

(繼承來源 TextElement)
IsAccessKeyScope

取得或設定值,這個值表示專案是否定義自己的便捷鍵範圍。

(繼承來源 TextElement)
IsTextScaleFactorEnabled

取得或設定是否啟用自動放大文字,以反映系統文字大小設定。

(繼承來源 TextElement)
KeyTipHorizontalOffset

取得或設定值,這個值表示相對於文字專案放置按鍵提示的左邊或右邊。

(繼承來源 TextElement)
KeyTipPlacementMode

取得或設定值,這個值表示 KeyTip 相對於文字元素放置的位置。

(繼承來源 TextElement)
KeyTipVerticalOffset

取得或設定值,這個值表示相對於文字元素放置按鍵提示的上下距離。

(繼承來源 TextElement)
Language

取得或設定適用于 TextElement的當地語系化/全球化語言資訊。

(繼承來源 TextElement)
Name

取得或設定 物件的唯一識別。 名稱只能從 XAML 的初始剖析中設定。

(繼承來源 TextElement)
TextDecorations

取得或設定值,這個值表示套用至文字的裝飾。

(繼承來源 TextElement)
XamlRoot

取得或設定正在檢視這個專案的 XamlRoot。

(繼承來源 TextElement)

方法

ClearValue(DependencyProperty)

清除相依性屬性的本機值。

(繼承來源 DependencyObject)
FindName(String)

藉由參考物件的 x:NameName 屬性值,擷取物件模型/執行時間物件圖形中的物件。

(繼承來源 TextElement)
GetAnimationBaseValue(DependencyProperty)

傳回為相依性屬性建立的任何基底值,如果動畫未使用中,則適用此屬性。

(繼承來源 DependencyObject)
GetValue(DependencyProperty)

DependencyObject傳回相依性屬性的目前有效值。

(繼承來源 DependencyObject)
OnDisconnectVisualChildren()

覆寫這個方法,以實作從類別特定內容或子屬性移除專案時,配置和邏輯的行為方式。

(繼承來源 TextElement)
ReadLocalValue(DependencyProperty)

如果已設定本機值,則傳回相依性屬性的本機值。

(繼承來源 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

註冊通知函式,以接聽此DependencyObject實例上特定DependencyProperty的變更。

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定 DependencyObject上相依性屬性的本機值。

(繼承來源 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消先前透過呼叫 RegisterPropertyChangedCallback註冊的變更通知。

(繼承來源 DependencyObject)

事件

AccessKeyDisplayDismissed

發生于便捷鍵順序完成以通知控制項應該隱藏便捷鍵視覺效果時。

(繼承來源 TextElement)
AccessKeyDisplayRequested

發生于啟動便捷鍵順序以通知控制項應該顯示便捷鍵視覺效果時。

(繼承來源 TextElement)
AccessKeyInvoked

發生于使用者完成存取金鑰序列以通知專案應該叫用存取金鑰動作時。

(繼承來源 TextElement)

適用於

另請參閱