ContentDialog 類別

定義

代表一個可自訂的對話框,包含勾選框、超連結、按鈕及其他 XAML 內容。

/// [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 ContentDialog : ContentControl
[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 class ContentDialog : ContentControl
Public Class ContentDialog
Inherits ContentControl
<ContentDialog .../>
-or-
<ContentDialog>
    singleObject
</ContentDialog>
-or-
<ContentDialog>stringContent</ContentDialog>
繼承
屬性

範例

Tip

欲了解更多資訊、設計指引及程式碼範例,請參見 對話控制項

WinUI 3 Gallery 應用程式包含大部分 WinUI 3 控制項、特性和功能的互動式範例。 從 Microsoft Store 取得應用程式,或在 GitHub 上取得原始程式碼。

這個範例展示了如何在程式碼中建立並顯示一個簡單的 ContentDialog。

Important

此範例假設對話是從 頁面顯示。 若要從 視窗顯示對話,請參見備註中的 「設定 XamlRoot 」部分。

private async void DisplayNoWifiDialog()
{
    ContentDialog noWifiDialog = new ContentDialog()
    {
        XamlRoot = this.XamlRoot,
        Title = "No wifi connection",
        Content = "Check connection and try again.",
        CloseButtonText = "Ok"
    };

    await noWifiDialog.ShowAsync();
}

這個範例展示了如何在應用程式頁面的 XAML 中建立 ContentDialog。 雖然對話框在應用程式頁面定義,但直到你在程式碼中呼叫 ShowAsync 才會顯示出來。

此處, IsPrimaryButtonEnabled 屬性設定為 false。 當使用者勾選核 方塊以確認年齡時,主要按鈕會在程式碼中啟用。

TitleTemplate 屬性用於建立包含標誌與文字的標題。

<ContentDialog x:Name="termsOfUseContentDialog"
           PrimaryButtonText="Accept" IsPrimaryButtonEnabled="False"
           CloseButtonText="Cancel"
           Opened="TermsOfUseContentDialog_Opened">
    <ContentDialog.TitleTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <Image Source="ms-appx:///Assets/SmallLogo.png" Width="40" Height="40" Margin="10,0"/>
                <TextBlock Text="Terms of use"/>
            </StackPanel>
        </DataTemplate>
    </ContentDialog.TitleTemplate>
    <StackPanel>
        <TextBlock TextWrapping="WrapWholeWords">
        <Run>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor
             congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus
             malesuada libero, sit amet commodo magna eros quis urna.</Run><LineBreak/>
        <Run>Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.</Run><LineBreak/>
        <Run>Pellentesque habitant morbi tristique senectus et netus et malesuada fames
             ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.</Run><LineBreak/>
        <Run>Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc.
             Mauris eget neque at sem venenatis eleifend. Ut nonummy.</Run>
        </TextBlock>
        <CheckBox x:Name="ConfirmAgeCheckBox" Content="I am over 13 years of age."
              Checked="ConfirmAgeCheckBox_Checked" Unchecked="ConfirmAgeCheckBox_Unchecked"/>
    </StackPanel>
</ContentDialog>
private async void ShowTermsOfUseContentDialogButton_Click(object sender, RoutedEventArgs e)
{
    termsOfUseContentDialog.XamlRoot = this.XamlRoot;
    ContentDialogResult result = await termsOfUseContentDialog.ShowAsync();
    if (result == ContentDialogResult.Primary)
    {
        // Terms of use were accepted.
    }
    else
    {
        // User pressed Cancel, ESC, or the back arrow.
        // Terms of use were not accepted.
    }
}

private void TermsOfUseContentDialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
    // Ensure that the check box is unchecked each time the dialog opens.
    ConfirmAgeCheckBox.IsChecked = false;
}

private void ConfirmAgeCheckBox_Checked(object sender, RoutedEventArgs e)
{
    termsOfUseContentDialog.IsPrimaryButtonEnabled = true;
}

private void ConfirmAgeCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
    termsOfUseContentDialog.IsPrimaryButtonEnabled = false;
}

此範例展示了如何建立並使用更複雜的自訂對話框(SignInContentDialog),源自 ContentDialog。 另請參閱本文的 「WinUI 風格導出控制 項」章節。

<ContentDialog
    x:Class="ContentDialog_WinUI3.SignInContentDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ContentDialog_WinUI3"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="SIGN IN"
    PrimaryButtonText="Sign In"  
    CloseButtonText="Cancel"
    PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
    CloseButtonClick="ContentDialog_CloseButtonClick">

    <ContentDialog.Resources>
        <Style TargetType="local:SignInContentDialog" BasedOn="{StaticResource DefaultContentDialogStyle}"/>
    </ContentDialog.Resources>

    <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        <TextBox Name="userNameTextBox" Header="User name"
                 TextChanged="UserNameTextBox_TextChanged"/>
        <PasswordBox Name="passwordTextBox" Header="Password" IsPasswordRevealButtonEnabled="True"
                     PasswordChanged="PasswordTextBox_PasswordChanged"/>
        <CheckBox Name="saveUserNameCheckBox" Content="Save user name"/>
        <InfoBar x:Name="errorInfoBar" Severity="Error" IsOpen="False" IsClosable="False"/>

        <!-- Content body -->
        <TextBlock Name="body" Style="{StaticResource BodyTextBlockStyle}" TextWrapping="Wrap">
            <TextBlock.Text>
                Lorem ipsum dolor sit amet, consectetur adipisicing elit,
                    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            </TextBlock.Text>
        </TextBlock>
    </StackPanel>
</ContentDialog>
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Threading.Tasks;

namespace ContentDialog_WinUI3
{
    public enum SignInResult
    {
        SignInOK,
        SignInFail,
        SignInCancel,
        Nothing
    }

    public sealed partial class SignInContentDialog : ContentDialog
    {
        public SignInResult Result { get; private set; }

        public SignInContentDialog()
        {
            this.InitializeComponent();
            this.Opened += SignInContentDialog_Opened;
            this.Closing += SignInContentDialog_Closing;
        }

        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Ensure the user name and password fields aren't empty. If a required
            // field is empty, set args.Cancel = true to keep the dialog open.
              if (string.IsNullOrEmpty(userNameTextBox.Text))
            {
                errorInfoBar.Message = "User name is required.";
                errorInfoBar.IsOpen = true;
            }
            else if (string.IsNullOrEmpty(passwordTextBox.Password))
            {
                errorInfoBar.Message = "Password is required.";
                errorInfoBar.IsOpen = true;
            }
            args.Cancel = errorInfoBar.IsOpen;

            // If you're performing async operations in the button click handler,
            // get a deferral before you await the operation. Then, complete the
            // deferral when the async operation is complete.
            if (args.Cancel == false) 
            {
                ContentDialogButtonClickDeferral deferral = args.GetDeferral();
                if (await SimulateAsyncSignInOperation())
                {
                    this.Result = SignInResult.SignInOK;
                }
                else
                {
                    this.Result = SignInResult.SignInFail;
                }
                deferral.Complete();
            }
        }

        private async Task<bool> SimulateAsyncSignInOperation()
        {
            // return true to simulate sign-in success.
            return true;
            // return false to simulate sign-in failure.
            /// return false;
        }

        private void ContentDialog_CloseButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // User clicked Cancel, ESC, or the system back button.
            this.Result = SignInResult.SignInCancel;
        }

        void SignInContentDialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
        {
            this.Result = SignInResult.Nothing;

            // If the user name is saved, get it and populate the user name field.
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values.ContainsKey("userName"))
            {
                userNameTextBox.Text = localSettings.Values["userName"].ToString();
                saveUserNameCheckBox.IsChecked = true;
            }
        }

        void SignInContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
        {
            // If sign in was successful, save or clear the user name based on the user choice.
            if (this.Result == SignInResult.SignInOK)
            {
                if (saveUserNameCheckBox.IsChecked == true)
                {
                    SaveUserName();
                }
                else
                {
                    ClearUserName();
                }
            }
        }

        private void SaveUserName()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["userName"] = userNameTextBox.Text;
        }

        private void ClearUserName()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["userName"] = null;
            userNameTextBox.Text = string.Empty;
        }

        private void UserNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            // Clear the error if the user name field isn't empty.
            if (!string.IsNullOrEmpty(userNameTextBox.Text))
            {
                errorInfoBar.Message = string.Empty;
                errorInfoBar.IsOpen = false;
            }
        }

        private void PasswordTextBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            // Clear the error if the password field isn't empty.
            if (!string.IsNullOrEmpty(passwordTextBox.Password))
            {
                errorInfoBar.Message = string.Empty;
                errorInfoBar.IsOpen = false;
            }
        }
    }
}

這裡有一段程式碼,顯示並 SignInContentDialog 使用其自訂 SignInResult的 。

private async void ShowSignInDialogButton_Click(object sender, RoutedEventArgs e)
{
    SignInContentDialog signInDialog = new SignInContentDialog()
    {
        XamlRoot = rootPanel.XamlRoot
    };
    await signInDialog.ShowAsync();

    if (signInDialog.Result == SignInResult.SignInOK)
    {
        // Sign in was successful.
    }
    else if (signInDialog.Result == SignInResult.SignInFail)
    {
        // Sign in failed.
    }
    else if (signInDialog.Result == SignInResult.SignInCancel)
    {
        // Sign in was cancelled by the user. 
    }
}

備註

Tip

欲了解更多資訊、設計指引及程式碼範例,請參見 對話控制項

使用 ContentDialog 來向使用者請求輸入,或在模態對話框中顯示資訊。 你可以用程式碼或 XAML 在應用程式頁面新增 ContentDialog,或者建立由 ContentDialog 衍生的自訂對話類別。 這兩種方式都在本主題的範例部分有展示。

標題

使用 Title 屬性在對話框中放置標題。 若要新增包含超過簡單文字的複雜標題元素,可以使用 TitleTemplate 屬性。

指令按鈕

ContentDialog 內建有三個按鈕,描述使用者在對話對話提示下可能採取的動作。 所有對話都應該有安全且非破壞性的動作。 對話也可以選擇性地包含一到兩個針對提示的「執行」動作。

使用 PrimaryButtonTextSecondaryButtonText 屬性來顯示對話框中主要問題或動作的回應。

使用 CloseButtonText 屬性來設定安全且非破壞性按鈕的顯示文字。 當使用者執行 取消 動作(如按下 ESC 鍵或系統返回鍵)時,對話框的關閉按鈕也會被觸發。

您可以隨意選擇將三個按鈕其中之一區分為對話方塊的預設按鈕。 使用 DefaultButton 屬性來區分其中一個按鈕。 此按鈕會獲得重音按鈕的視覺處理,自動回應 ENTER 鍵,並在對話開啟時獲得焦點,除非對話內容包含可聚焦元素。

展示對話並使用其結果

要顯示對話框,請呼叫 ShowAsync 方法。 使用此方法回傳的 ContentDialogResult 來判斷有點擊過哪些按鈕。 如果使用者按下 ESC、系統返回方向鍵或 Gamepad B,這個方法的結果會是 None

設定 XamlRoot

當您顯示 ContentDialog 時,您必須手動將對話框的 XamlRoot 設定為 XAML 主機的根目錄。 若要這樣做,請將 ContentDialog 的 XamlRoot 屬性設定為與已在 XAML 樹狀結構中的元素相同的 XamlRoot。

如果 ContentDialog 是 從頁面顯示的,你可以將 ContentDialog 的 XamlRoot 屬性設為該頁面的 XamlRoot 屬性( XamlRoot = this.XamlRoot)。

Window 沒有 XamlRoot 屬性,因此如果對話框是從 Window 顯示,請將對話框的 XamlRoot 屬性設定為 Window 根內容元素的 XamlRoot 屬性,如下所示。

<Window
    ... >
    <Grid x:Name="rootPanel">

    </Grid>
</Window>
private async void DisplayNoWifiDialog()
{
    ContentDialog noWifiDialog = new ContentDialog
    {
        XamlRoot = rootPanel.XamlRoot,
        Title = "No wifi connection",
        Content = "Check your connection and try again.",
        CloseButtonText = "Ok"
    };

    ContentDialogResult result = await noWifiDialog.ShowAsync();
}

關閉對話框

你可能想在對話結束前做一些工作(例如,確認使用者在提交請求前已將資料輸入表單欄位)。 在對話結束前,你有兩種方式可以完成工作。 你可以處理 PrimaryButtonClickSecondaryButtonClickCloseButtonClick 事件,讓使用者按下按鈕時得到回應,並在對話結束前驗證對話狀態。 你也可以處理 關閉 事件,在對話結束前完成工作。

一次只能顯示一個 ContentDialog。 若要串接多個 ContentDialog,請處理第一個 ContentDialog 的 Closing 事件。 在 結束 事件處理程序中,呼叫第二個對話框的 ShowAsync 來顯示它。

警告

每個執行緒一次只能開啟一個 ContentDialog。 嘗試開啟兩個 ContentDialogs 會拋出例外,即使它們嘗試在不同的應用程式視窗中開啟。

帶有 WinUI 風格的衍生控制項

如果你從現有的 XAML 控制項衍生出自訂控制項,預設不會取得 WinUI 樣式。 若要套用 WinUI 樣式:

  • 建立新的 Style,並將其 TargetType 設為您的自定義控制項。
  • 以您衍生自之控件的預設樣式為基礎。

一個常見的情境是從 ContentDialog 衍生出新的控制項。 此範例示範如何建立套用 DefaultContentDialogStyle 至自定義對話框的新 Style。

<ContentDialog
    x:Class="ExampleApp.SignInContentDialog"
    ... >
    <ContentDialog.Resources>
        <Style TargetType="local:SignInContentDialog" 
               BasedOn="{StaticResource DefaultContentDialogStyle}"/>
    </ContentDialog.Resources> 
    <!-- CONTENT -->
</ContentDialog>

控制樣式與範本

你可以修改預設 的樣式控制範本 ,讓控制項呈現獨特的外觀。 關於修改控制項樣式與範本的資訊,請參見 XAML 樣式。 預設樣式、範本及定義控制項外觀的資源皆包含於檔案中 generic.xaml 。 設計上,generic.xaml 是隨 Windows App SDK NuGet 套件安裝的。 根據預設,此位置為 \Users\<username>\.nuget\packages\microsoft.windowsappsdk\<version>\lib\uap10.0\Microsoft.UI\Themes\generic.xaml。 不同版本的 SDK 的樣式和資源可能有不同的值。

XAML 也包含資源,可以在不修改控制範本的情況下,修改控制項在不同視覺狀態下的顏色。 修改這些資源比設定 背景前景等屬性更為可取。 更多資訊請參考 XAML 風格文章中的輕量化造型部分。

建構函式

名稱 Description
ContentDialog()

初始化 ContentDialog 類別的新實例。

屬性

名稱 Description
AccessKey

取得或設定此元素的存取鍵(助記鍵)。

(繼承來源 UIElement)
AccessKeyScopeOwner

取得或設定一個來源元素,提供該元素的存取鍵作用域,即使該元素不在原始元素的視覺樹中。

(繼承來源 UIElement)
ActualHeight

會取得 FrameworkElement 的渲染高度。 請參閱備註。

(繼承來源 FrameworkElement)
ActualOffset

取得此 UIElement 相對於其父節點的位置,該位置是在佈局流程的排列過程中計算出來的。

(繼承來源 UIElement)
ActualSize

取得該 UIElement 在佈局流程安排過程中計算出的大小。

(繼承來源 UIElement)
ActualTheme

取得該元素目前使用的 UI 主題,這可能和 RequestedTheme 不同。

(繼承來源 FrameworkElement)
ActualWidth

它會取得 FrameworkElement 的渲染寬度。 請參閱備註。

(繼承來源 FrameworkElement)
AllowDrop

取得或設定一個值,判斷該 UIElement 是否能作為拖放操作的丟棄目標。

(繼承來源 UIElement)
AllowFocusOnInteraction

會獲得或設定一個值,指示該元素在使用者互動時是否自動獲得焦點。

(繼承來源 FrameworkElement)
AllowFocusWhenDisabled

取得或設定失效控制是否能接收焦點。

(繼承來源 FrameworkElement)
Background

取得或設定一個畫筆作為控制背景。

(繼承來源 Control)
BackgroundSizing

取得或設定一個值,表示背景相對於該元素邊界的延伸距離。

(繼承來源 Control)
BaseUri

取得一個統一資源識別碼(URI),代表 XAML 載入時所建構物件的基礎 URI。 此特性對執行時的 URI 解析非常有用。

(繼承來源 FrameworkElement)
BorderBrush

取得或設定一個筆刷,描述控制點的邊框填充。

(繼承來源 Control)
BorderThickness

取得或設定控制區的邊框厚度。

(繼承來源 Control)
CacheMode

取得或設定一個值,表示渲染內容應盡可能以合成點陣圖形式快取。

(繼承來源 UIElement)
CanBeScrollAnchor

取得或設定一個值,指示 UIElement 是否適合作為捲動錨定的候選對象。

(繼承來源 UIElement)
CanDrag

取得或設定一個值,指示該元素是否能以拖放操作的方式被拖曳為資料。

(繼承來源 UIElement)
CenterPoint

取得或設定元素的中心點,即旋轉或縮放發生的中心點。 會影響元素的渲染位置。

(繼承來源 UIElement)
CharacterSpacing

取得或設定字元間的均勻間距,單位為 1/1000 的 em。

(繼承來源 Control)
Clip

取得或設定用於定義 UIElement 內容輪廓的矩形幾何。

(繼承來源 UIElement)
CloseButtonCommand

當按下關閉鍵時,會取得或設定呼叫指令。

CloseButtonCommandParameter

取得或設定參數,讓關閉按鈕的指令傳達給指令。

CloseButtonCommandParameterProperty

取得 CloseButtonCommandParameter 依賴屬性的識別碼。

CloseButtonCommandProperty

取得 CloseButtonCommand 相依屬性的識別碼。

CloseButtonStyle

取得或設定套用到對話框關閉按鈕上的樣式。

CloseButtonStyleProperty

取得 CloseButtonStyle 相依屬性的識別碼。

CloseButtonText

讀取或設定文字顯示在關閉鍵上。

CloseButtonTextProperty

取得 CloseButtonText 依賴屬性的識別碼。

CompositeMode

取得或設定一個屬性,宣告該元素在其父版面配置與視窗中的替代合成與混合模式。 這對於涉及混合 XAML / Microsoft DirectX UI 的元素非常重要。

(繼承來源 UIElement)
Content

取得或設定 ContentControl 的內容。

(繼承來源 ContentControl)
ContentTemplate

取得或設定用於顯示 ContentControl 內容的資料範本。

(繼承來源 ContentControl)
ContentTemplateRoot

取得由 ContentTemplate 屬性指定的資料範本的根元素。

(繼承來源 ContentControl)
ContentTemplateSelector

根據執行時處理內容項目或其容器的資訊,取得或設定一個選擇物件,改變 DataTemplate 以應用於內容。

(繼承來源 ContentControl)
ContentTransitions

取得或設定適用於 ContentControl 內容的 Transition 風格元素集合。

(繼承來源 ContentControl)
ContextFlyout

取得或設定與此元素相關的飛出。

(繼承來源 UIElement)
CornerRadius

取得或設定控制點邊界角落的半徑。

(繼承來源 Control)
DataContext

取得或設定 FrameworkElement 的資料上下文。 資料上下文的常見用途是 a FrameworkElement 使用 {Binding} 標記擴充並參與資料綁定。

(繼承來源 FrameworkElement)
DefaultButton

會取得或設定一個值,指示對話框中哪個按鈕是預設動作。

DefaultButtonProperty

取得 DefaultButton 相依屬性的識別碼。

DefaultStyleKey

取得或設定指向該控制項預設風格的鍵。 自訂控制項的作者會利用這個屬性來更改他們控制項所用風格的預設值。

(繼承來源 Control)
DefaultStyleResourceUri

取得或設定包含控制項預設樣式的資源檔案路徑。

(繼承來源 Control)
DesiredSize

取得該 UIElement 在佈局過程的測度通過時計算出的大小。

(繼承來源 UIElement)
Dispatcher

它總是在 Windows App SDK 應用程式中回傳 null 。 改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

得到 DispatcherQueue 這個物件所關聯的那個。 代表 DispatcherQueue 一個功能,即使程式碼是由非 UI 執行緒發起,也能存取 UI DependencyObject 執行緒。

(繼承來源 DependencyObject)
ElementSoundMode

取得或設定一個值,指定控制項偏好是否播放聲音。

(繼承來源 Control)
ExitDisplayModeOnAccessKeyInvoked

取得或設定一個值,指定在呼叫存取鍵時是否會關閉存取鍵顯示。

(繼承來源 UIElement)
FlowDirection

它設定文字及其他 UI 元素在任何控制其版面配置的父元素內流動的方向。 此屬性可設定為或 LeftToRightRightToLeft。 將 設定 FlowDirection 為 對 RightToLeft 任意元素,會將比對順序設定為右至左,控制鍵的配置則由右向左流動。

(繼承來源 FrameworkElement)
FocusState

會得到一個值,指定此控制是否具備對焦功能,以及取得對焦的方式。

(繼承來源 UIElement)
FocusVisualMargin

取得或設定 FrameworkElement 焦點視覺化的外圍。

(繼承來源 FrameworkElement)
FocusVisualPrimaryBrush

取得或設定用來繪製框架元素外邊界HighVisibilityReveal聚焦視覺化的畫筆。

(繼承來源 FrameworkElement)
FocusVisualPrimaryThickness

取得或設定框架元素外層邊界HighVisibility的厚度,或Reveal聚焦視覺化。

(繼承來源 FrameworkElement)
FocusVisualSecondaryBrush

取得或設定用來繪製框架元素內邊界HighVisibilityReveal或聚焦視覺化的畫筆。

(繼承來源 FrameworkElement)
FocusVisualSecondaryThickness

取得或設定框架元素內邊界HighVisibility的厚度,或Reveal聚焦視覺化的視覺化。

(繼承來源 FrameworkElement)
FontFamily

取得或設定用於控制項中顯示文字的字型。

(繼承來源 Control)
FontSize

在此控制項中取得或設定文字大小。

(繼承來源 Control)
FontStretch

決定字體在螢幕上的濃縮或擴展程度。

(繼承來源 Control)
FontStyle

取得或設定文字呈現的樣式。

(繼承來源 Control)
FontWeight

取得或設定指定字型的粗細。

(繼承來源 Control)
Foreground

取得或設定一筆筆來描述前景色。

(繼承來源 Control)
FullSizeDesired

取得或設定一個值,指示是否請求顯示對話框的完整大小。

FullSizeDesiredProperty

取得 FullSizeDesired 相依屬性的識別碼。

Height

取得或設定 FrameworkElement 的建議高度。

(繼承來源 FrameworkElement)
HighContrastAdjustment

取得或設定一個值,指示框架在啟用高對比主題時是否自動調整元素的視覺屬性。

(繼承來源 UIElement)
HorizontalAlignment

取得或設定在 FrameworkElement 組合於版面父元件(如面板或項目控制項)時套用的水平對齊特性。

(繼承來源 FrameworkElement)
HorizontalContentAlignment

取得或設定控制項內容的水平對齊。

(繼承來源 Control)
IsAccessKeyScope

取得或設定一個值,指示元素是否定義其存取鍵作用域。

(繼承來源 UIElement)
IsDoubleTapEnabled

取得或設定一個值,決定 DoubleTapped 事件是否能從該元素產生。

(繼承來源 UIElement)
IsEnabled

取得或設定一個值,指示使用者是否能與控制項互動。

(繼承來源 Control)
IsFocusEngaged

設定一個值,表示使用者按下遊戲控制器的 A/Select 鍵時,焦點是否被限制在控制鍵上。

(繼承來源 Control)
IsFocusEngagementEnabled

取得或設定一個值,指示使用者按下遊戲控制器的 A/Select 鍵時,焦點是否能被限制在控制鍵上。

(繼承來源 Control)
IsHitTestVisible

取得或設定此 UIElement 所包含區域是否能回傳真實值以進行命中測試。

(繼承來源 UIElement)
IsHoldingEnabled

取得或設定一個值,決定 持有事件是否 能從該元素產生。

(繼承來源 UIElement)
IsLoaded

會得到一個值,表示該元素是否已被加入元素樹並準備好進行互動。

(繼承來源 FrameworkElement)
IsPrimaryButtonEnabled

可以設定對話框的主要按鈕是否被啟用。

IsPrimaryButtonEnabledProperty

取得 IsPrimaryButtonEnabled 相依屬性的識別碼。

IsRightTapEnabled

取得或設定一個值,決定 RightTapped 事件是否能從該元素產生。

(繼承來源 UIElement)
IsSecondaryButtonEnabled

設定對話框的次要按鈕是否啟用。

IsSecondaryButtonEnabledProperty

取得 IsSecondaryButtonEnabled 相依屬性的識別碼。

IsTabStop

取得或設定一個值,指示分頁導覽中是否包含某個控制項。

(繼承來源 UIElement)
IsTapEnabled

取得或設定一個值,決定 Tapped 事件是否能從該元素產生。

(繼承來源 UIElement)
IsTextScaleFactorEnabled

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

(繼承來源 Control)
KeyboardAcceleratorPlacementMode

取得或設定一個值,指示控制 工具提示是否顯示 其對應鍵盤加速器的按鍵組合。

(繼承來源 UIElement)
KeyboardAcceleratorPlacementTarget

取得或設定一個值,指示顯示加速器按鍵組合的控制 工具提示

(繼承來源 UIElement)
KeyboardAccelerators

取得一組按鍵組合,用鍵盤觸發動作。

加速器通常分配給按鈕或選單項目。

顯示各種選單項目鍵盤加速器的選單範例
顯示各種選單項目鍵盤加速器的選單範例

(繼承來源 UIElement)
KeyTipHorizontalOffset

取得或設定一個值,表示鍵尖相對於 UIElement 的位置有多左或多右。

(繼承來源 UIElement)
KeyTipPlacementMode

取得或設定一個值,指示存取鍵提示相對於 UIElement 邊界的位置。

(繼承來源 UIElement)
KeyTipTarget

取得或設定一個值,指示存取鍵提示所鎖定的元素。

(繼承來源 UIElement)
KeyTipVerticalOffset

它會取得或設定一個值,表示鍵尖相對於 UI 元素的上下位置。

(繼承來源 UIElement)
Language

取得或設定適用於 FrameworkElement 的本地化/全球化語言資訊,同時也適用於物件表示法和 UI 中目前 FrameworkElement 的所有子元素。

(繼承來源 FrameworkElement)
Lights

會讓 XamlLight 物件集合附加到這個元素上。

(繼承來源 UIElement)
ManipulationMode

取得或設定用於 UIElement 行為及手勢互動的 ManipulationModes 值。 設定此值後,能在應用程式程式碼中處理該元素的操作事件。

(繼承來源 UIElement)
Margin

取得或設定 FrameworkElement 的外緣。

(繼承來源 FrameworkElement)
MaxHeight

取得或設定 FrameworkElement 的最大高度限制。

(繼承來源 FrameworkElement)
MaxWidth

取得或設定 FrameworkElement 的最大寬度限制。

(繼承來源 FrameworkElement)
MinHeight

取得或設定 FrameworkElement 的最小高度限制。

(繼承來源 FrameworkElement)
MinWidth

取得或設定 FrameworkElement 的最小寬度限制。

(繼承來源 FrameworkElement)
Name

取得或設定物件的識別名稱。 當 XAML 處理器從 XAML 標記建立物件樹時,執行時程式碼可以以此名稱來指稱 XAML 宣告的物件。

(繼承來源 FrameworkElement)
Opacity

取得或設定物件不透明度的度數。

(繼承來源 UIElement)
OpacityTransition

取得或設定 ScalarTransition,用來動畫化 Opacity 屬性的變更。

(繼承來源 UIElement)
Padding

在控制區內取得或設定填充物。

(繼承來源 Control)
Parent

取得物件樹中 FrameworkElement 的父物件。

(繼承來源 FrameworkElement)
PointerCaptures

取得所有捕獲指標的集合,以 指標 值表示。

(繼承來源 UIElement)
PrimaryButtonCommand

當按下主按鈕時,會接收或設定呼叫指令。

PrimaryButtonCommandParameter

取得或設定參數,讓它傳給主按鈕的指令。

PrimaryButtonCommandParameterProperty

取得 PrimaryButtonCommandParameter 依賴屬性的識別碼。

PrimaryButtonCommandProperty

取得 PrimaryButtonCommand 依賴屬性的識別碼。

PrimaryButtonStyle

取得或設定樣式套用到對話框的主要按鈕。

PrimaryButtonStyleProperty

取得 PrimaryButtonStyle 相依屬性的識別碼。

PrimaryButtonText

取得或設定文字顯示在主按鈕上。

PrimaryButtonTextProperty

取得 PrimaryButtonText 相依屬性的識別碼。

Projection

在渲染這個元素時,會取得或設定投影(3D 效果)來套用。

(繼承來源 UIElement)
ProtectedCursor

取得或設定游標,當指標位於此元素上時會顯示。 預設為 null,表示游標沒有變化。

(繼承來源 UIElement)
RasterizationScale

會獲得一個代表額外比例因子的值,用於渲染形狀、影像、文字或媒體,通常是為了渲染比一般解析度更高的解析度。

(繼承來源 UIElement)
RenderSize

會取得 UIElement 的最終渲染大小。 不建議使用此,詳見備註。

(繼承來源 UIElement)
RenderTransform

取得或設定影響 UIElement 渲染位置的轉換資訊。

(繼承來源 UIElement)
RenderTransformOrigin

取得或設定 RenderTransform 宣告的任何可能渲染轉換的起點,相對於 UIElement 的界限。

(繼承來源 UIElement)
RequestedTheme

取得或設定 UI 主題,該主題由 UIElement (及其子元素)用於資源判定。 你指定的 RequestedTheme UI 主題可以覆蓋應用程式層級 的 RequestedTheme

(繼承來源 FrameworkElement)
RequiresPointer

可設定或設定 UI 元素是否支援滑鼠模式,模擬與非指標輸入裝置(如鍵盤或遊戲控制器)的指標互動體驗。

(繼承來源 Control)
Resources

取得本地定義的資源字典。 在 XAML 中,你可以透過 XAML 隱含的集合語法,將資源項目建立為屬性元素的 frameworkElement.Resources 子物件元素。

(繼承來源 FrameworkElement)
Rotation

設定順時針旋轉的角度,以度數為單位。 相對於旋轉軸和中心點旋轉。 會影響元素的渲染位置。

(繼承來源 UIElement)
RotationAxis

讓軸線旋轉元素。

(繼承來源 UIElement)
RotationTransition

取得或設定 ScalarTransition,讓 Rotation 屬性的變化動畫化。

(繼承來源 UIElement)
Scale

取得或設定元素的比例。 相對於元素的中心點進行縮放。 會影響元素的渲染位置。

(繼承來源 UIElement)
ScaleTransition

取得或設定 Vector3Transition,用來動畫化 Scale 屬性的變更。

(繼承來源 UIElement)
SecondaryButtonCommand

當按下次要按鈕時,能接收或設定呼叫指令。

SecondaryButtonCommandParameter

取得或設定參數,傳遞給次要按鈕的指令。

SecondaryButtonCommandParameterProperty

取得 SecondaryButtonCommandParameter 依賴屬性的識別碼。

SecondaryButtonCommandProperty

取得 SecondaryButtonCommand 依賴屬性的識別碼。

SecondaryButtonStyle

取得或設定樣式套用到對話框的次要按鈕。

SecondaryButtonStyleProperty

取得 SecondaryButtonStyle 相依屬性的識別碼。

SecondaryButtonText

取得或設定文字顯示在次要按鈕上。

SecondaryButtonTextProperty

取得 SecondaryButtonText 相依屬性的識別碼。

Shadow

取得或設定 元素所轉換的陰影效果。

(繼承來源 UIElement)
Style

在版面設計和渲染過程中,會取得或設定一個實例樣 ,應用於該物件。

(繼承來源 FrameworkElement)
TabFocusNavigation

取得或設定一個值,改變 tab 鍵和 TabIndex 對此控制項的運作方式。

(繼承來源 UIElement)
TabIndex

取得或設定一個值,決定使用者使用 Tab 鍵在控制項中移動時,元素獲得焦點的順序。

(繼承來源 UIElement)
TabNavigation

取得或設定一個值,改變 Tab 鍵和 UIElement.TabIndex 對此控制項的運作方式。

備註

在Windows 10 Creators Update(建置版 10.0.15063)及更新版本中,UIElement 基底類別中可使用 TabFocusNavigation 屬性,以包含不使用 ControlTemplate 的物件。

(繼承來源 Control)
Tag

取得或設定一個任意物件值,可用來儲存該物件的自訂資訊。

(繼承來源 FrameworkElement)
Template

取得或設定控制範本。 控制範本定義了使用者介面中控制項的視覺外觀,並以 XAML 標記方式定義。

(繼承來源 Control)
Title

取得或設定對話標題。

TitleProperty

取得產權依賴屬性的識別碼。

TitleTemplate

取得或設定職稱範本。

TitleTemplateProperty

取得 TitleTemplate 依賴屬性的識別碼。

Transform3D

在渲染這個元素時,會取得或設定 3D 轉換效果套用。

(繼承來源 UIElement)
TransformMatrix

取得或設定轉換矩陣以套用到元素。

(繼承來源 UIElement)
Transitions

取得或設定適用於 UIElementTransition 風格元素集合。

(繼承來源 UIElement)
Translation

取得或設定元素的 x、y 和 z 渲染位置。

(繼承來源 UIElement)
TranslationTransition

取得或設定 Vector3Transition,用來動畫化 Translation 屬性的變更。

(繼承來源 UIElement)
Triggers

取得為 FrameworkElement 定義的動畫觸發器集合。 不常用。 請參閱備註。

(繼承來源 FrameworkElement)
UseLayoutRounding

取得或設定一個值,決定物件及其視覺子樹的渲染是否應該使用捨入行為,使渲染對齊到整像素。

(繼承來源 UIElement)
UseSystemFocusVisuals

取得或設定一個值,指示控制使用系統繪製的焦點視覺化,還是控制模板中定義的焦點視覺化。

(繼承來源 UIElement)
VerticalAlignment

取得或設定當 FrameworkElement 被組合在父物件(如面板或項目控制項)時,套用到的垂直對齊特性。

(繼承來源 FrameworkElement)
VerticalContentAlignment

取得或設定控制項內容的垂直對齊。

(繼承來源 Control)
Visibility

取得或設定 UIElement 的可見性。 不可見的 A UIElement 不會被渲染,也無法向佈局傳達其期望大小。

(繼承來源 UIElement)
Width

取得或設定 FrameworkElement 的寬度。

(繼承來源 FrameworkElement)
XamlRoot

取得或設定 XamlRoot 該元素正在被觀看的區域。

(繼承來源 UIElement)
XYFocusDown

當使用者按下遊戲控制器的方向鍵(方向鍵)時,會取得或設定該物件被聚焦的目標。

(繼承來源 UIElement)
XYFocusDownNavigationStrategy

取得或設定一個值,指定用以決定下行導覽目標元素的策略。

(繼承來源 UIElement)
XYFocusKeyboardNavigation

取得或設定一個值,使鍵盤方向鍵導覽啟用或停用。

(繼承來源 UIElement)
XYFocusLeft

當使用者按下遊戲控制器方向鍵(D-pad)左鍵時,會取得或設定該物件被聚焦。

(繼承來源 UIElement)
XYFocusLeftNavigationStrategy

取得或設定一個值,指定用來決定左邊導航目標元素的策略。

(繼承來源 UIElement)
XYFocusRight

當使用者按下遊戲控制器方向鍵(方向鍵)時,該物件會被聚焦。

(繼承來源 UIElement)
XYFocusRightNavigationStrategy

取得或設定一個值,指定用以決定右向導航目標元素的策略。

(繼承來源 UIElement)
XYFocusUp

當使用者按下遊戲控制器的方向鍵(D-pad)時,會取得或設定該物件會被聚焦。

(繼承來源 UIElement)
XYFocusUpNavigationStrategy

取得或設定一個值,指定用以決定上行導航目標元素的策略。

(繼承來源 UIElement)

方法

名稱 Description
AddHandler(RoutedEvent, Object, Boolean)

為指定的路由事件新增一個路由事件處理器,並將該處理器加入目前元素的處理器集合中。 指定handledEventsTootrue即使事件在其他地方處理,也能呼叫所提供的處理器。

(繼承來源 UIElement)
ApplyTemplate()

載入相關的控制範本,使其部分可以被引用。

(繼承來源 Control)
Arrange(Rect)

定位子物件並決定 UIElement 的大小。 為其子元素實作自訂版面配置的父物件,應從其版面覆寫實作中呼叫此方法,形成遞迴版面更新。

(繼承來源 UIElement)
ArrangeOverride(Size)

提供佈局「編排」路徑的行為。 類別可以覆寫此方法,定義自己的「排列」傳遞行為。

(繼承來源 FrameworkElement)
CancelDirectManipulations()

取消任何包含當前 UIElementScrollViewer 父程式上的直接操作處理(系統定義的平移/縮放)。

(繼承來源 UIElement)
CapturePointer(Pointer)

將指標擷取設定到 UIElement。 一旦被捕獲,只有被捕獲的元素會觸發與指標相關的事件。

(繼承來源 UIElement)
ClearValue(DependencyProperty)

清除依賴性財產的局部價值。

(繼承來源 DependencyObject)
FindName(String)

擷取具有指定識別碼名稱的物件。

(繼承來源 FrameworkElement)
FindSubElementsForTouchTargeting(Point, Rect)

啟用 UIElement 子類別,以揭露有助於解決觸控目標的子元素。

(繼承來源 UIElement)
Focus(FocusState)

嘗試將焦點設定為這個專案。

(繼承來源 UIElement)
GetAnimationBaseValue(DependencyProperty)

回傳任何為相依屬性建立的基礎值,適用於動畫未啟用時。

(繼承來源 DependencyObject)
GetBindingExpression(DependencyProperty)

回傳代表指定屬性綁定的 BindingExpression

(繼承來源 FrameworkElement)
GetChildrenInTabFocusOrder()

啟用 UIElement 子類別,以暴露參與 Tab 焦點的子元素。

(繼承來源 UIElement)
GetTemplateChild(String)

擷取實例化的 ControlTemplate 視覺樹中命名的元素。

(繼承來源 Control)
GetValue(DependencyProperty)

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

(繼承來源 DependencyObject)
GetVisualInternal()

取回該元素所解析的 。Visual

(繼承來源 UIElement)
GoToElementStateCore(String, Boolean)

當在衍生類別中實作時,能在程式碼中為控制範本逐狀態建構視覺化樹,而非在控制啟動時載入所有狀態的 XAML。

(繼承來源 FrameworkElement)
Hide()

隱藏對話內容。

InvalidateArrange()

使 UIElement 的 arrange 狀態(layout)失效。 失效後, UIElement 的版面會被非同步更新。

(繼承來源 UIElement)
InvalidateMeasure()

使 UIElement 的測量狀態(佈局)失效。

(繼承來源 UIElement)
InvalidateViewport()

會使用於計算有效視窗UIElement 的視窗狀態失效。

(繼承來源 FrameworkElement)
Measure(Size)

更新 UIElementDesiredSize 。 通常,實作自訂版面版面子版面的物件會從自己的 MeasureOverride 實作中呼叫此方法,形成遞迴版面更新。

(繼承來源 UIElement)
MeasureOverride(Size)

提供佈局週期中「測量」通道的行為。 類別可以覆寫此方法,定義自己的「Measure」通過行為。

(繼承來源 FrameworkElement)
OnApplyTemplate()

每當應用程式碼或內部程序(如重建版面操作)呼叫 ApplyTemplate 時,都會被呼叫。 簡單來說,這表示在應用程式中顯示 UI 元素之前,會呼叫這個方法。 覆寫此方法以影響類別預設的模板後邏輯。

(繼承來源 FrameworkElement)
OnBringIntoViewRequested(BringIntoViewRequestedEventArgs)

BringIntoViewRequested 事件發生前被呼叫。

(繼承來源 UIElement)
OnCharacterReceived(CharacterReceivedRoutedEventArgs)

CharacterReceived 事件發生前被呼叫。

(繼承來源 Control)
OnContentChanged(Object, Object)

內容 屬性的價值改變時會被啟動。

(繼承來源 ContentControl)
OnContentTemplateChanged(DataTemplate, DataTemplate)

ContentTemplate 屬性的值改變時會被呼叫。

(繼承來源 ContentControl)
OnContentTemplateSelectorChanged(DataTemplateSelector, DataTemplateSelector)

ContentTemplateSelector 屬性的值改變時會被呼叫。

(繼承來源 ContentControl)
OnCreateAutomationPeer()

當在衍生類別中實作時,會回傳類別專屬的 AutomationPeer Microsoft UI Automation基礎架構的實作。

(繼承來源 UIElement)
OnDisconnectVisualChildren()

覆寫此方法,實作當類別特定內容或子屬性移除項目時,版面與邏輯應如何運作。

(繼承來源 UIElement)
OnDoubleTapped(DoubleTappedRoutedEventArgs)

DoubleTipped 事件發生前呼叫。

(繼承來源 Control)
OnDragEnter(DragEventArgs)

DragEnter 事件發生前被呼叫。

(繼承來源 Control)
OnDragLeave(DragEventArgs)

DragLeave 事件發生前被呼叫。

(繼承來源 Control)
OnDragOver(DragEventArgs)

DragOver 事件發生前被呼叫。

(繼承來源 Control)
OnDrop(DragEventArgs)

Drop 事件發生前被呼叫。

(繼承來源 Control)
OnGotFocus(RoutedEventArgs)

GotFocus 事件發生前被召喚。

(繼承來源 Control)
OnHolding(HoldingRoutedEventArgs)

Holding 事件發生前被叫走。

(繼承來源 Control)
OnKeyboardAcceleratorInvoked(KeyboardAcceleratorInvokedEventArgs)

當鍵盤 快捷鍵(或加速器) 在你的應用程式中處理時會被呼叫。 覆寫此方法,以處理應用程式在啟動鍵盤加速器時的回應。

(繼承來源 UIElement)
OnKeyDown(KeyRoutedEventArgs)

KeyDown 事件發生前就被打電話。

(繼承來源 Control)
OnKeyUp(KeyRoutedEventArgs)

KeyUp 事件發生前就被叫來。

(繼承來源 Control)
OnLostFocus(RoutedEventArgs)

LostFocus 事件發生前被呼叫。

(繼承來源 Control)
OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)

ManipulationCompleted 事件發生前被呼叫。

(繼承來源 Control)
OnManipulationDelta(ManipulationDeltaRoutedEventArgs)

ManipulationDelta 事件發生前被呼叫。

(繼承來源 Control)
OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs)

操控慣性啟動 事件發生前被召喚。

(繼承來源 Control)
OnManipulationStarted(ManipulationStartedRoutedEventArgs)

ManipulationStarted 事件發生前被呼叫。

(繼承來源 Control)
OnManipulationStarting(ManipulationStartingRoutedEventArgs)

ManipulationStarting 事件發生前被呼叫。

(繼承來源 Control)
OnPointerCanceled(PointerRoutedEventArgs)

PointerCanceled 事件發生前被呼叫。

(繼承來源 Control)
OnPointerCaptureLost(PointerRoutedEventArgs)

PointerCaptureLost 事件發生前呼叫。

(繼承來源 Control)
OnPointerEntered(PointerRoutedEventArgs)

PointerEntered 事件發生前被呼叫。

(繼承來源 Control)
OnPointerExited(PointerRoutedEventArgs)

PointerExited 事件發生前被呼叫。

(繼承來源 Control)
OnPointerMoved(PointerRoutedEventArgs)

PointerMoved 事件發生前被呼叫。

(繼承來源 Control)
OnPointerPressed(PointerRoutedEventArgs)

PointerPressed 事件發生前被呼叫。

(繼承來源 Control)
OnPointerReleased(PointerRoutedEventArgs)

PointerRelease 事件發生前呼叫。

(繼承來源 Control)
OnPointerWheelChanged(PointerRoutedEventArgs)

PointerWheelChanged 事件發生前被呼叫。

(繼承來源 Control)
OnPreviewKeyDown(KeyRoutedEventArgs)

PreviewKeyDown 事件發生前被呼叫。

(繼承來源 Control)
OnPreviewKeyUp(KeyRoutedEventArgs)

PreviewKeyUp 事件發生前被呼叫。

(繼承來源 Control)
OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)

在你的應用程式處理鍵盤 快捷鍵(或加速器) 之前,這會被呼叫。 每當應用程式程式碼或內部程序呼叫 ProcessKeyboardAccelators 時會被呼叫。 覆寫此方法以影響預設加速器的處理方式。

(繼承來源 UIElement)
OnRightTapped(RightTappedRoutedEventArgs)

RightTapped 事件發生前被呼叫。

(繼承來源 Control)
OnTapped(TappedRoutedEventArgs)

Tapped 事件發生前被叫出。

(繼承來源 Control)
PopulatePropertyInfo(String, AnimationPropertyInfo)

定義了一個可以被動畫化的屬性。

(繼承來源 UIElement)
PopulatePropertyInfoOverride(String, AnimationPropertyInfo)

當在派生類別中覆寫時,定義了一個可被動畫化的屬性。

(繼承來源 UIElement)
ReadLocalValue(DependencyProperty)

若設定了本地值,則回傳依賴性質的局部值。

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

註冊一個通知函式,用於監聽此 DependencyObject 實例中特定 DependencyProperty 的變更。

(繼承來源 DependencyObject)
ReleasePointerCapture(Pointer)

UIElement 釋放指標擷取以捕捉特定指標。

(繼承來源 UIElement)
ReleasePointerCaptures()

釋放此元素所持有的所有指標捕獲。

(繼承來源 UIElement)
RemoveFocusEngagement()

解除支援遊戲控制器互動的焦點限制( IsFocusEngaged 為真)。

(繼承來源 Control)
RemoveHandler(RoutedEvent, Object)

移除此 UIElement 中指定的路由事件處理程序。 通常該處理器是由 AddHandler 新增的。

(繼承來源 UIElement)
SetBinding(DependencyProperty, BindingBase)

利用提供的綁定物件將綁定附加到 FrameworkElement

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

將相依屬性的局部值設定在 DependencyObject 上。

(繼承來源 DependencyObject)
ShowAsync()

開始一個非同步操作以顯示對話。

ShowAsync(ContentDialogPlacement)

開始一個非同步操作,顯示與指定位置對話的對話。

StartAnimation(ICompositionAnimationBase)

開始該元素的指定動畫。

(繼承來源 UIElement)
StartBringIntoView()

向 XAML 框架發起請求,要求將元素在任何可捲動的區域內顯示。

(繼承來源 UIElement)
StartBringIntoView(BringIntoViewOptions)

會向 XAML 框架發起請求,使用指定的選項將元素帶入視野。

(繼承來源 UIElement)
StartDragAsync(ExpPointerPoint)

代表一個可自訂的對話框,包含勾選框、超連結、按鈕及其他 XAML 內容。

(繼承來源 UIElement)
StartDragAsync(PointerPoint)

啟動拖放操作。

Important

若使用者以管理員身份以提升模式執行應用程式,則不支援。

(繼承來源 UIElement)
StopAnimation(ICompositionAnimationBase)

停止元素上指定的動畫。

(繼承來源 UIElement)
TransformToVisual(UIElement)

回傳一個轉換物件,可用於將座標從 UIElement 轉換到指定物件。

(繼承來源 UIElement)
TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)

嘗試透過搜尋整個 UIElement 視覺樹來呼叫 鍵盤捷徑(或 加速器)。

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

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

(繼承來源 DependencyObject)
UpdateLayout()

確保 UIElement 中所有子物件的位置都正確更新以進行版面配置。

(繼承來源 UIElement)

事件

名稱 Description
AccessKeyDisplayDismissed

當存取鑰匙不再顯示時會發生。

(繼承來源 UIElement)
AccessKeyDisplayRequested

當使用者請求顯示存取金鑰時,會發生這種情況。

(繼承來源 UIElement)
AccessKeyInvoked

當使用者完成一組存取金鑰序列時,會發生這種情況。

(繼承來源 UIElement)
ActualThemeChanged

當 ActualTheme 房產價值變動時,會發生這種情況。

(繼承來源 FrameworkElement)
BringIntoViewRequested

StartBringIntoView 被呼叫於此元素或其後代時,會發生此情況。

(繼承來源 UIElement)
CharacterReceived

當輸入佇列接收到單一已組合好字元時,會發生這種情況。

(繼承來源 UIElement)
CloseButtonClick

在按下關閉鍵後發生。

Closed

發生在對話結束後。

Closing

發生在對話開始關閉後,但在對話結束前,且在關閉事件發生之前。

ContextCanceled

當上下文輸入手勢繼續進入操作手勢時,會發生,以通知元素不應該開啟上下文飛出。

(繼承來源 UIElement)
ContextRequested

當使用者完成上下文輸入手勢(例如右鍵點擊)時會發生。

(繼承來源 UIElement)
DataContextChanged

FrameworkElement.DataContext 屬性的值改變時,會發生這種情況。

(繼承來源 FrameworkElement)
DoubleTapped

當未處理的 DoubleTap 互動發生在本元件的命中測試區域時,會發生這種情況。

(繼承來源 UIElement)
DragEnter

當輸入系統回報以該元素為目標的底層拖曳事件時,會發生這種情況。

(繼承來源 UIElement)
DragLeave

當輸入系統回報以此元素為原點的底層拖曳事件時,會發生這種情況。

(繼承來源 UIElement)
DragOver

當輸入系統回報一個底層拖曳事件,該元素為潛在的投放目標時發生。

(繼承來源 UIElement)
DragStarting

當啟動拖曳操作時會發生。

(繼承來源 UIElement)
Drop

當輸入系統回報一個底層丟棄事件,並將此元素作為丟棄目標時發生。

(繼承來源 UIElement)
DropCompleted

當以此元素為來源的拖放操作結束時,會發生此現象。

(繼承來源 UIElement)
EffectiveViewportChanged

FrameworkElement的有效視口 改變時,會發生這種情況。

(繼承來源 FrameworkElement)
FocusDisengaged

當使用者按下遊戲控制器的 B/Back 鍵時,控制器上的焦點會被釋放。

(繼承來源 Control)
FocusEngaged

當使用者按下遊戲控制器的 A/Select 鍵時,焦點被限制在控制器上時會發生。

(繼承來源 Control)
GettingFocus

發生在 UIElement 獲得焦點之前。 這個事件會同步提高,以確保活動在進行時焦點不會被轉移。

(繼承來源 UIElement)
GotFocus

UIElement 獲得焦點時會發生。 此事件會非同步啟動,因此焦點能在沸騰完成前再次移動。

(繼承來源 UIElement)
Holding

當本元素的命中測試區域發生原本未處理的 Hold 互動時,會發生這種情況。

(繼承來源 UIElement)
IsEnabledChanged

IsEnabled 屬性變更時會發生。

(繼承來源 Control)
KeyDown

UIElement 正在對焦時按下鍵盤鍵時,會發生這種情況。

(繼承來源 UIElement)
KeyUp

UIElement 正在對焦時放開鍵盤鍵時會發生。

(繼承來源 UIElement)
LayoutUpdated

當視覺樹的配置改變時,會發生在與佈局相關的屬性改變值或其他會刷新佈局的動作時。

(繼承來源 FrameworkElement)
Loaded

FrameworkElement 已被建構並加入物件樹,並準備進行互動時,會發生這種情況。

(繼承來源 FrameworkElement)
Loading

FrameworkElement 開始載入時會發生。

(繼承來源 FrameworkElement)
LosingFocus

發生在 UIElement 失去焦點之前。 這個事件會同步提高,以確保活動在進行時焦點不會被轉移。

(繼承來源 UIElement)
LostFocus

UIElement 失去焦點時會發生。 此事件會非同步啟動,因此焦點能在沸騰完成前再次移動。

(繼承來源 UIElement)
ManipulationCompleted

當對 UIElement 進行操作完成時,會發生。

(繼承來源 UIElement)
ManipulationDelta

當輸入裝置在操作期間變更位置時發生。

(繼承來源 UIElement)
ManipulationInertiaStarting

當輸入裝置在操作過程中失去與 UIElement 物件的接觸,導致慣性開始時,會發生這種情況。

(繼承來源 UIElement)
ManipulationStarted

當輸入裝置開始對 UIElement 進行操作時,會發生這種情況。

(繼承來源 UIElement)
ManipulationStarting

第一次建立操作處理器時發生。

(繼承來源 UIElement)
NoFocusCandidateFound

當使用者嘗試移動焦點(透過 Tab 鍵或方向箭頭)但焦點無法移動,因為該方向找不到焦點候選時,會發生這種情況。

(繼承來源 UIElement)
Opened

發生在對話開啟後。

PointerCanceled

當一個曾經接觸到的指標異常失去接觸時,就會發生這種情況。

(繼承來源 UIElement)
PointerCaptureLost

當該元素先前持有的指標捕獲移至其他元素或其他位置時,會發生此現象。

(繼承來源 UIElement)
PointerEntered

當指標進入該元素的命中測試區域時發生。

(繼承來源 UIElement)
PointerExited

當指標離開該元素的命中測試區域時,會發生。

(繼承來源 UIElement)
PointerMoved

當指標移動時,指標仍停留在該元素的命中測試區域內。

(繼承來源 UIElement)
PointerPressed

當指標裝置在此元素內啟動 按鍵 動作時,會發生這種情況。

(繼承來源 UIElement)
PointerReleased

當先前發起 新聞 行動的指標裝置在此元素內被釋放時,會發生這種情況。 請注意, 新聞行動 結束時不保證觸發 PointerReleased 事件;其他事件可能會觸發。 更多資訊請參閱 備註。

(繼承來源 UIElement)
PointerWheelChanged

當指標輪的 delta 值改變時,會發生這種情況。

(繼承來源 UIElement)
PreviewKeyDown

UIElement 正在對焦時按下鍵盤鍵時,會發生這種情況。

(繼承來源 UIElement)
PreviewKeyUp

UIElement 正在對焦時放開鍵盤鍵時會發生。

(繼承來源 UIElement)
PrimaryButtonClick

發生在按下主按鈕後。

ProcessKeyboardAccelerators

當按下 鍵盤快捷鍵(或加速器) 時會發生。

(繼承來源 UIElement)
RightTapped

當指標正好在元素上方時,右鍵輸入刺激發生。

(繼承來源 UIElement)
SecondaryButtonClick

在點擊次要按鈕後發生。

SizeChanged

ActualHeightActualWidth 屬性在 FrameworkElement 上的值改變時,會發生這種情況。

(繼承來源 FrameworkElement)
Tapped

當未處理的 Tap 互動發生在該元件的命中測試區域時。

(繼承來源 UIElement)
Unloaded

當該物件不再連接到主物件樹時,會發生這種情況。

(繼承來源 FrameworkElement)

適用於

另請參閱