Block 類別

定義

抽象類別,提供所有區塊層級內容專案的基底。

public ref class Block : TextElement
/// [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)]
class Block : TextElement
[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)]
public class Block : TextElement
Public Class Block
Inherits TextElement
繼承
Object Platform::Object IInspectable DependencyObject TextElement Block
衍生
屬性

Windows 需求

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

備註

Block 會定義應該套用至所有類型的封鎖內容的文字格式設定屬性。 這些屬性包括: LineHeightLineStackingStrategyMarginTextAlignment。 Block 也會繼承 TextElement 的文字格式設定屬性和其他 API。

在Windows 執行階段 XAML 詞彙中,唯一的區塊類型是Paragraph。 您可以使用 Paragraph 來定義 要顯示在 RichTextBlock 控制項內的文字區塊。 每個 RichTextBlock 都應該至少包含一個 Paragraph

BlockCollectionRichTextBlock.Blocks 屬性所使用的強型別集合類別。 藉由在 RichTextBlock內指定 XAML 物件元素,您可以指派 RichTextBlock的區塊文字內容。 這通常是使用隱含集合和 XAML 屬性語法來完成,讓 Paragraph 元素在 XAML 標記中顯示為 RichTextBlock 的直接子系。 例如:

<RichTextBlock>
  <Paragraph>First paragraph.</Paragraph>
  <Paragraph>Second paragraph.</Paragraph>
  <Paragraph>Third paragraph. <Bold>With an inline.</Bold></Paragraph>
</RichTextBlock>

封鎖 衍生類別

Block 是 Paragraph的父類別。

移轉注意事項

Windows 執行階段 XAML 詞彙不支援Section類別。 如果您要從WINDOWS PRESENTATION FOUNDATION (WPF) 或 Microsoft Silverlight 移轉 XAML,請改用Paragraph區塊元素。

版本歷程記錄

Windows 版本 SDK 版本 新增值
1709 16299 HorizontalTextAlignment

建構函式

Block()

提供 區塊 衍生類別的基類初始化行為。

屬性

AccessKey

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

(繼承來源 TextElement)
AccessKeyScopeOwner

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

(繼承來源 TextElement)
AllowFocusOnInteraction

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

(繼承來源 TextElement)
CharacterSpacing

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

(繼承來源 TextElement)
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)
HorizontalTextAlignment

取得或設定值,這個值表示如何在 Block 中對齊文字。

HorizontalTextAlignmentProperty

識別 HorizontalTextAlignment 相依性屬性。

IsAccessKeyScope

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

(繼承來源 TextElement)
IsTextScaleFactorEnabled

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

(繼承來源 TextElement)
KeyTipHorizontalOffset

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

(繼承來源 TextElement)
KeyTipPlacementMode

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

(繼承來源 TextElement)
KeyTipVerticalOffset

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

(繼承來源 TextElement)
Language

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

(繼承來源 TextElement)
LineHeight

取得或設定每行內容的高度。

LineHeightProperty

識別 LineHeight 相依性屬性。

LineStackingStrategy

取得或設定值,這個值表示如何為 區塊中的每個文字行決定行框。

LineStackingStrategyProperty

識別 LineStackingStrategy 相 依性屬性。

Margin

取得或設定 Block 元素周圍的空間量。

MarginProperty

識別 Margin 相依性屬性。

Name

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

(繼承來源 TextElement)
TextAlignment

取得或設定文字內容的水準對齊方式。

TextAlignmentProperty

識別 TextAlignment 相依性屬性。

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)

適用於

另請參閱