Share via


InlineUIContainer 类

定义

提供一个内联内容元素,该元素使 UIElement 类型能够嵌入 到 RichTextBlock 的内容中。

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

继承
Object Platform::Object IInspectable DependencyObject TextElement Inline InlineUIContainer
属性

示例

下面的代码示例演示如何使用 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 元素 (一种类型的 Inline) ,而不是使用带有 Button 或类似的 InlineUIContainer。 有关 链接,请参阅指南

InlineUIContainer 从 TextElement 类继承属性。 但是,其中大多数属性没有任何可见效果。 最常见的是在 XAML 中声明 InlineUIContainer 对象元素,而不 (设置任何属性,但可能 x :Name 属性) 与作为 InlineUIContainer 对象元素内容的单个子元素一起内联。

在 InlineUIContainer 上设置属性以其他方式影响文本元素的字符行高, (如 FontSizeFontFamily) 对呈现和外观没有影响。 内容决定其大小和 InlineUIContainer 大小以适应它。

如果子内容 ((如 TextBlock.Text )或嵌套 RichTextBlock 中的其他文本元素) InlineUIContainer 父级的文本元素属性不会继承到内容中,则忽略它们。

构造函数

InlineUIContainer()

初始化 InlineUIContainer 类的新实例。

属性

AccessKey

获取或设置此元素的访问键。

(继承自 TextElement)
AccessKeyScopeOwner

获取或设置一个源元素,该元素为此元素提供访问键范围,即使它不在源元素的可视化树中也是如此。

(继承自 TextElement)
AllowFocusOnInteraction

获取或设置一个值,该值指示当用户与元素交互时是否自动获得焦点。

(继承自 TextElement)
CharacterSpacing

获取或设置字符之间的统一间距,单位为 em 的 1/1000。

(继承自 TextElement)
Child

获取或设置由 InlineUIContainer 托管的 UIElement

ContentEnd

获取一个 TextPointer ,它表示 元素中内容的结尾。

(继承自 TextElement)
ContentStart

获取一个 TextPointer ,它表示 元素中内容的开头。

(继承自 TextElement)
Dispatcher

始终在Windows 应用 SDK应用中返回 null 。 请改用 DispatcherQueue

(继承自 DependencyObject)
DispatcherQueue

获取 DispatcherQueue 与此 对象关联的 。 DispatcherQueue表示可以访问 DependencyObject UI 线程上的 的功能,即使代码是由非 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

获取或设置一个值,该值指示键提示相对于文本元素放置的位置。

(继承自 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)

适用于

另请参阅