ContentDialog 類別

定義

表示對話方塊,這個對話方塊可以自訂成包含核取方塊、超連結、按鈕和任何其他 XAML 內容。

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

Windows 需求

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

範例

提示

如需詳細資訊、設計指引和程式碼範例,請參閱 對話方塊控制項

如果您已安裝 WinUI 2 資源庫 應用程式,請按一下這裡 開啟應用程式並查看 ContentDialog 運作情形

此範例示範如何在程式碼中建立及顯示簡單的 ContentDialog。

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

    await noWifiDialog.ShowAsync();
}

此範例示範如何在應用程式頁面的 XAML 中建立 ContentDialog。 雖然對話方塊是在應用程式頁面中定義,但除非您在程式碼中呼叫 ShowAsync ,否則不會顯示該對話方塊。

在這裡, IsPrimaryButtonEnabled 屬性會設定為 false。 當使用者檢查 CheckBox 以確認其年齡時,主要按鈕會在程式碼中啟用。

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)
{
    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 2.2 或更新版本,另請參閱 具有 WinUI 樣式的衍生控制項

<!-- SignInContentDialog.xaml -->
<ContentDialog
    x:Class="ExampleApp.SignInContentDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ExampleApp"
    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>
    <!-- Uncomment this Style if using WinUI 2.2 or later. -->
    <!-- <Style TargetType="local:SignInContentDialog" BasedOn="{StaticResource DefaultContentDialogStyle}"/> -->

    <!-- These flyouts or used for confirmation when the user changes
         the option to save their user name. -->
        <Flyout x:Key="DiscardNameFlyout" Closed="Flyout_Closed">
            <StackPanel>
                <TextBlock Text="Discard user name?"/>
                <Button Content="Discard" Click="DiscardButton_Click"/>
            </StackPanel>
        </Flyout>
        <Flyout x:Key="SaveNameFlyout" Closed="Flyout_Closed">
            <StackPanel>
                <TextBlock Text="Save user name?"/>
                <Button Content="Save" Click="SaveButton_Click"/>
            </StackPanel>
        </Flyout>
    </ContentDialog.Resources>

    <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        <TextBox Name="userNameTextBox" Header="User name"/>
        <PasswordBox Name="passwordTextBox" Header="Password" IsPasswordRevealButtonEnabled="True"/>
        <CheckBox Name="saveUserNameCheckBox" Content="Save user name"/>

        <TextBlock x:Name="errorTextBlock" Style="{StaticResource ControlContextualInfoTextBlockStyle}"/>

        <!-- Content body -->
        <TextBlock Name="body" Style="{StaticResource MessageDialogContentStyle}" 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>
// SignInContentDialog.xaml.cs
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;

namespace ExampleApp
{
    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 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))
            {
                args.Cancel = true;
                errorTextBlock.Text = "User name is required.";
            }
            else if (string.IsNullOrEmpty(passwordTextBox.Password))
            {
                args.Cancel = true;
                errorTextBlock.Text = "Password is required.";
            }

            // 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.

            ContentDialogButtonClickDeferral deferral = args.GetDeferral();    
            if (await SomeAsyncSignInOperation())
            {
                this.Result = SignInResult.SignInOK;
            }
            else
            {
                this.Result = SignInResult.SignInFail;
            }
            deferral.Complete();
        }

        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 roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            if (roamingSettings.Values.ContainsKey("userName"))
            {
                userNameTextBox.Text = roamingSettings.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();
                }
            }

            // If the user entered a name and checked or cleared the 'save user name' checkbox, then clicked the back arrow,
            // confirm if it was their intention to save or clear the user name without signing in.
            if (this.Result == SignInResult.Nothing && !string.IsNullOrEmpty(userNameTextBox.Text))
            {
                if (saveUserNameCheckBox.IsChecked == false)
                {
                    args.Cancel = true;
                    FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["DiscardNameFlyout"]);
                    FlyoutBase.ShowAttachedFlyout(this);
                }
                else if (saveUserNameCheckBox.IsChecked == true && !string.IsNullOrEmpty(userNameTextBox.Text))
                {
                    args.Cancel = true;
                    FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["SaveNameFlyout"]);
                    FlyoutBase.ShowAttachedFlyout(this);
                }
            }
        }

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

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

        // Handle the button clicks from the flyouts.
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            SaveUserName();
            FlyoutBase.GetAttachedFlyout(this).Hide();
        }

        private void DiscardButton_Click(object sender, RoutedEventArgs e)
        {
            ClearUserName();
            FlyoutBase.GetAttachedFlyout(this).Hide();
        }

        // When the flyout closes, hide the sign in dialog, too.
        private void Flyout_Closed(object sender, object e)
        {
            this.Hide();
        }
    }
}

以下是顯示 SignInContentDialog 和使用其自訂 SignInResult 的程式碼。

private async void ShowSignInDialogButton_Click(object sender, RoutedEventArgs e)
{
    SignInContentDialog signInDialog = new SignInContentDialog();
    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.
    }
}

備註

提示

如需詳細資訊、設計指引和程式碼範例,請參閱 對話方塊控制項

使用 ContentDialog 向使用者要求輸入,或在強制回應對話方塊中顯示資訊。 您可以使用程式碼或 XAML 將 ContentDialog 新增至應用程式頁面,也可以建立衍生自 ContentDialog 的自訂對話方塊類別。 本主題的範例一節會顯示這兩種方式。

使用 Title 屬性將標題放在對話方塊上。 若要新增具有多個簡單文字的複雜標題專案,您可以使用 TitleTemplate 屬性。

ContentDialog 有 3 個內建按鈕,描述使用者可能會採取的動作,以回應對話方塊的提示。 所有對話都應該有安全、非破壞性的動作。 對話方塊也可以選擇性地包含一或兩個特定的「執行動作」,以回應提示。

使用 CloseButtonText 和 屬性來設定安全、非破壞性按鈕的顯示文字。 當使用者執行取消動作時,也會叫用對話方塊的關閉按鈕,例如按下 ESC 鍵或按下系統返回按鈕。 使用 PrimaryButtonTextSecondaryButtonText 屬性來顯示對話方塊所提出主要問題或動作的回應。

Windows 10 1703 版之前,無法使用CloseButtonText屬性。 如果您的 App 在 Microsoft Visual Studio 中的「最低平臺版本」設定小於此頁面稍後的 Requirements 區塊中顯示的「引進版本」,您應該改用 SecondaryButtonText 屬性。 如需詳細資訊,請參閱 版本調適型程式碼

若要顯示對話方塊,請呼叫 ShowAsync 方法。 使用這個方法的結果,判斷按一下任何按鈕時,按一下哪一個按鈕。 如果使用者按下 ESC 鍵、系統返回箭號或遊戲台 B,這個方法的結果將會是 None。

您可以隨意選擇將三個按鈕其中之一區分為對話方塊的預設按鈕。 使用 DefaultButton 屬性來區分其中一個按鈕。 除非對話方塊的內容包含可設定焦點的專案,否則此按鈕會收到輔色按鈕視覺處理、自動回應 ENTER 鍵,並在開啟對話方塊時接收焦點。

例如,您可能想要在對話方塊關閉 (之前執行一些工作,在提交要求) 之前,先確認使用者已輸入表單欄位。 在對話方塊關閉之前,您有兩種方式可以執行工作。 您可以處理PrimaryButtonClickSecondaryButtonClick 或 CloseButtonClick事件,以在使用者按下按鈕並確認對話方塊關閉之前的狀態時取得使用者的回應。 您也可以處理 Closing 事件,以在對話方塊關閉之前執行工作。

一次只能顯示一個 ContentDialog。 若要將多個 ContentDialog 鏈結在一起,請處理第一個 ContentDialog 的 Closing 事件。 在 Closing 事件處理常式中,于第二個對話方塊上呼叫 ShowAsync 以顯示它。

具有 WinUI 樣式的衍生控制項

注意:本節僅適用于使用 WinUI 2.2 或更新版本的應用程式。

Windows UI 程式庫2.2 或更新版本包含使用此更新樣式之控制項的新範本。 如果您從現有的 XAML 控制項衍生自訂控制項,則預設不會取得 WinUI 2 樣式。 若要套用 WinUI 2 樣式:

  • 建立新的 Style ,並將其 TargetType 設為您的自訂控制項。
  • 根據您衍生自之控制項的預設樣式來設定樣式。

其中一個常見的案例是從 ContentDialog衍生新的控制項。 此範例示範如何建立套用 DefaultContentDialogStyle 至自訂對話方塊的新 Style。

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

ContentDialog AppWindow 或 Xaml Islands

注意:這一節僅適用於目標為 Windows 10 版本 1903 或更新版本的應用程式。 AppWindow 和 XAML Islands 不適用於舊版。 如需版本設定的詳細資訊,請參閱版本調適型應用程式

根據預設,內容對話方塊顯示強制相對於根目錄 ApplicationView。 當您使用 AppWindowXAML Island 內的 ContentDialog 時,您需要在對話方塊上將 XamlRoot 手動設為 XAML 主機的根目錄。

若要這麼做,請將 ContentDialog 的 XamlRoot 屬性設定為與 AppWindow 或 XAML Island 中現有元素相同的 XamlRoot,如下所示。

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

    // Use this code to associate the dialog to the appropriate AppWindow by setting
    // the dialog's XamlRoot to the same XamlRoot as an element that is already present in the AppWindow.
    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
    {
        noWifiDialog.XamlRoot = elementAlreadyInMyAppWindow.XamlRoot;
    }

    ContentDialogResult result = await noWifiDialog.ShowAsync();
}

警告

每個執行緒一次只能開啟一個 ContentDialog。 嘗試開啟兩個 ContentDialogs 會擲回例外狀況,即使它們嘗試在不同的 AppWindows 中開啟。

控制項樣式和範本

您可以修改預設 的 StyleControlTemplate ,讓控制項具有唯一的外觀。 如需修改控制項樣式和範本的相關資訊,請參閱 設定控制項的樣式。 定義控制面板的預設樣式、範本和資源會包含在 檔案中 generic.xaml 。 為了設計目的, generic.xaml 可在本機使用 SDK 或 NuGet 套件安裝。

  • 建議) 的 WinUI 樣式 ( 如需 WinUI 的更新樣式,請參閱 \Users\<username>\.nuget\packages\microsoft.ui.xaml\<version>\lib\uap10.0\Microsoft.UI.Xaml\Themes\generic.xaml
  • 非 WinUI 樣式: 如需內建樣式,請參閱 %ProgramFiles(x86)%\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic\generic.xaml

如果您自訂安裝,位置可能會不同。 不同 SDK 版本的樣式和資源可能會有不同的值。

XAML 也包含資源,可讓您用來修改不同視覺狀態中控制項的色彩,而不需修改控制項範本。 修改這些資源是慣用的設定屬性,例如 BackgroundForeground。 如需詳細資訊,請參閱XAML 樣式文章的輕量型樣式一節。 從 Windows 10 版本 1607 (SDK 14393) 開始,即可使用輕量型樣式資源。

版本歷程記錄

Windows 版本 SDK 版本 新增值
1703 15063 CloseButtonClick
1703 15063 CloseButtonCommand
1703 15063 CloseButtonCommandParameter
1703 15063 CloseButtonStyle
1703 15063 CloseButtonText
1703 15063 DefaultButton
1703 15063 PrimaryButtonStyle
1703 15063 SecondaryButtonStyle
1709 16299 ShowAsync (ContentDialogPlacement)

建構函式

ContentDialog()

初始化 ContentDialog 類別的新實例。

屬性

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 載入時間 XAML 建構物件的基底統一資源識別元 (URI) 。 此屬性適用于執行時間的統一資源識別項 (URI) 解析。

(繼承來源 FrameworkElement)
BorderBrush

取得或設定描述控制項框線填滿的筆刷。

(繼承來源 Control)
BorderThickness

取得或設定控制項的框線粗細。

(繼承來源 Control)
CacheMode

取得或設定值,這個值表示盡可能將轉譯的內容快取為複合點陣圖。

(繼承來源 UIElement)
CanBeScrollAnchor

取得或設定值,這個值表示 UIElement 是否可為捲動錨定候選項目。

(繼承來源 UIElement)
CanDrag

取得或設定值,這個值表示是否可以將專案拖曳為拖放作業中的資料。

(繼承來源 UIElement)
CenterPoint

取得或設定專案的中心點,也就是發生旋轉或縮放的點。 影響專案的轉譯位置。

(繼承來源 UIElement)
CharacterSpacing

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

(繼承來源 Control)
Clip

取得或設定用來定義UIElement內容的大綱的RectangleGeometry

(繼承來源 UIElement)
CloseButtonCommand

取得或設定在點選關閉按鈕時要叫用的命令。

CloseButtonCommandParameter

取得或設定參數,以傳遞至關閉按鈕的命令。

CloseButtonCommandParameterProperty

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

CloseButtonCommandProperty

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

CloseButtonStyle

取得或設定要套用至對話方塊關閉按鈕的 Style

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的資料內容。 資料內容的常見用法是 當 FrameworkElement 使用 {Binding} 標記延伸並參與資料系結時。

(繼承來源 FrameworkElement)
DefaultButton

取得或設定值,這個值表示對話方塊上的哪個按鈕是預設動作。

DefaultButtonProperty

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

DefaultStyleKey

取得或設定參考控制項預設樣式的索引鍵。 自訂控制項的作者會使用此屬性來變更其控制項所使用的樣式預設值。

(繼承來源 Control)
DefaultStyleResourceUri

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

(繼承來源 Control)
DesiredSize

取得此 UIElement 在版面配置程式的量值階段期間計算的大小。

(繼承來源 UIElement)
Dispatcher

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

(繼承來源 DependencyObject)
ElementSoundMode

取得或設定值,指定是否播放音效的控制項喜好設定。

(繼承來源 Control)
ExitDisplayModeOnAccessKeyInvoked

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

(繼承來源 UIElement)
FlowDirection

取得或設定文字和其他 UI 元素在控制其版面配置的任何父元素內流動的方向。 這個屬性可以設定為 LeftToRightRightToLeft。 在任何元素上將 FlowDirection 設定為 RightToLeft ,會將對齊方式設定為右側、從右至左的讀取順序,以及控制項從右至左流動的版面配置。

(繼承來源 FrameworkElement)
FocusState

取得值,指定這個控制項是否有焦點,以及取得焦點的模式。

(繼承來源 Control)
FocusVisualMargin

取得或設定 FrameworkElement焦點視覺效果的外部邊界。

(繼承來源 FrameworkElement)
FocusVisualPrimaryBrush

取得或設定筆刷,用來繪製FrameworkElement之或 Reveal 焦點視覺效果的外部 HighVisibility 框線。

(繼承來源 FrameworkElement)
FocusVisualPrimaryThickness

取得或設定FrameworkElement之外部 Reveal 框線的 HighVisibility 粗細。

(繼承來源 FrameworkElement)
FocusVisualSecondaryBrush

取得或設定筆刷,用來繪製FrameworkElement之或 Reveal 焦點視覺效果的內部 HighVisibility 框線。

(繼承來源 FrameworkElement)
FocusVisualSecondaryThickness

取得或設定FrameworkElementHighVisibilityReveal 焦點視覺效果的內部框線粗細。

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

取得或設定值,這個值表示焦點是否受限於遊戲台/遠端互動 (控制項界限) 。

(繼承來源 Control)
IsFocusEngagementEnabled

取得或設定值,指出焦點是否可以限制在控制界限內, (遊戲台/遠端互動) 。

(繼承來源 Control)
IsHitTestVisible

取得或設定這個 UIElement 的包含區域是否可以傳回 true 值來進行點擊測試。

(繼承來源 UIElement)
IsHoldingEnabled

取得或設定值,這個值會判斷 Holding 事件是否可以來自該專案。

(繼承來源 UIElement)
IsLoaded

取得值,這個值表示專案是否已加入至專案樹狀結構,且已準備好進行互動。

(繼承來源 FrameworkElement)
IsPrimaryButtonEnabled

取得或設定對話方塊的主要按鈕是否已啟用。

IsPrimaryButtonEnabledProperty

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

IsRightTapEnabled

取得或設定值,這個值會判斷 RightTapped 事件是否可能來自該專案。

(繼承來源 UIElement)
IsSecondaryButtonEnabled

取得或設定對話方塊的次要按鈕是否已啟用。

IsSecondaryButtonEnabledProperty

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

IsTabStop

取得或設定值,這個值表示控制項是否包含於索引標籤巡覽。

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

取得或設定要套用至對話方塊主要按鈕的 Style

PrimaryButtonStyleProperty

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

PrimaryButtonText

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

PrimaryButtonTextProperty

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

Projection

取得或設定轉譯這個專案時要套用的 3D 效果) (3D 效果。

(繼承來源 UIElement)
RenderSize

取得 UIElement的最終轉譯大小。 不建議使用,請參閱。

(繼承來源 UIElement)
RenderTransform

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

(繼承來源 UIElement)
RenderTransformOrigin

取得或設定 RenderTransform所宣告之任何可能轉譯轉換的原點,相對於 UIElement的界限。

(繼承來源 UIElement)
RequestedTheme

取得或設定 UIElement (及其子項目所使用的 UI 主題,) 資源判斷。 您使用 RequestedTheme 指定的 UI 主題可以覆寫應用層級 RequestedTheme

(繼承來源 FrameworkElement)
RequiresPointer

取得或設定 UI 元素是否支援滑鼠模式,以模擬非指標輸入裝置的指標互動體驗,例如遊戲台或遠端控制。

(繼承來源 Control)
Resources

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

(繼承來源 FrameworkElement)
Rotation

取得或設定順時針旋轉的角度,以度為單位。 相對於 RotationAxis 和 CenterPoint 旋轉。 影響專案的轉譯位置。

(繼承來源 UIElement)
RotationAxis

取得或設定座標軸,以繞著旋轉專案。

(繼承來源 UIElement)
RotationTransition

取得或設定 ScalarTransition,以動畫顯示 Rotation 屬性的變更。

(繼承來源 UIElement)
Scale

取得或設定專案的刻度。 相對於專案的 CenterPoint 進行調整。 影響專案的轉譯位置。

(繼承來源 UIElement)
ScaleTransition

取得或設定 Vector3Transition,以動畫顯示 Scale 屬性的變更。

(繼承來源 UIElement)
SecondaryButtonCommand

取得或設定在點選次要按鈕時要叫用的命令。

SecondaryButtonCommandParameter

取得或設定參數,以傳遞至次要按鈕的命令。

SecondaryButtonCommandParameterProperty

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

SecondaryButtonCommandProperty

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

SecondaryButtonStyle

取得或設定要套用至對話方塊次要按鈕的 Style

SecondaryButtonStyleProperty

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

SecondaryButtonText

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

SecondaryButtonTextProperty

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

Shadow

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

(繼承來源 UIElement)
Style

取得或設定配置和轉譯期間,針對這個物件套用的實例 Style

(繼承來源 FrameworkElement)
TabFocusNavigation

取得或設定值,這個值會修改 Tabbing 和 TabIndex 對此控制項的運作方式。

(繼承來源 UIElement)
TabIndex

取得或設定值,指出當使用者使用 Tab 鍵流覽應用程式 UI 時,元素接收焦點的順序。

(繼承來源 Control)
TabNavigation

取得或設定值,這個值會修改 Tabbing 和 TabIndex 對此控制項的運作方式。

注意

針對Windows 10 Creators Update (組建 10.0.15063) 和更新版本,TabFocusNavigation屬性可在UIElement基類上使用,以在不使用ControlTemplate的索引標籤序列中包含物件。

(繼承來源 Control)
Tag

取得或設定可用來儲存此物件之自訂資訊的任意物件值。

(繼承來源 FrameworkElement)
Template

取得或設定控制項範本。 控制項範本會定義 UI 中控制項的視覺外觀,並在 XAML 標記中定義。

(繼承來源 Control)
Title

取得或設定對話方塊的標題。

TitleProperty

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

TitleTemplate

取得或設定標題範本。

TitleTemplateProperty

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

Transform3D

取得或設定轉譯這個專案時要套用的 3D 轉換效果。

(繼承來源 UIElement)
TransformMatrix

取得或設定要套用至專案的轉換矩陣。

(繼承來源 UIElement)
Transitions

取得或設定套用至UIElementTransition樣式專案集合。

(繼承來源 UIElement)
Translation

取得或設定專案的 x、y 和 z 轉譯位置。

(繼承來源 UIElement)
TranslationTransition

取得或設定 Vector3Transition,以動畫顯示 Translation 屬性的變更。

(繼承來源 UIElement)
Triggers

取得針對 FrameworkElement定義的動畫觸發程式集合。 不常使用。 請參閱<備註>。

(繼承來源 FrameworkElement)
UIContext

取得專案的內容識別碼。

(繼承來源 UIElement)
UseLayoutRounding

取得或設定值,這個值會決定物件及其視覺子樹的轉譯是否應該使用四捨五入行為,將轉譯對齊整個圖元。

(繼承來源 UIElement)
UseSystemFocusVisuals

取得或設定值,這個值表示控制項是否使用由系統或控制項範本中定義的焦點視覺效果。

(繼承來源 Control)
VerticalAlignment

取得或設定垂直對齊特性,當 FrameworkElement 是由面板或專案控制項等父物件所組成時套用至 FrameworkElement

(繼承來源 FrameworkElement)
VerticalContentAlignment

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

(繼承來源 Control)
Visibility

取得或設定 UIElement的可見度。 不可見的 UIElement 不會轉譯,而且不會將其所需的大小傳達給版面配置。

(繼承來源 UIElement)
Width

取得或設定 FrameworkElement的寬度。

(繼承來源 FrameworkElement)
XamlRoot

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

(繼承來源 UIElement)
XYFocusDown

取得或設定當使用者按下方向板 (D 鍵) 向下時取得焦點的物件。

(繼承來源 Control)
XYFocusDownNavigationStrategy

取得或設定值,指定用來判斷向下導覽目標元素的策略。

(繼承來源 UIElement)
XYFocusKeyboardNavigation

取得或設定值,這個值會啟用或停用使用鍵盤方向箭號的流覽。

(繼承來源 UIElement)
XYFocusLeft

取得或設定當使用者按下方向板 (D 鍵) 左鍵時取得焦點的物件。

(繼承來源 Control)
XYFocusLeftNavigationStrategy

取得或設定值,指定用來判斷左側導覽目標元素的策略。

(繼承來源 UIElement)
XYFocusRight

取得或設定當使用者按下方向板 (D 鍵) 右鍵時取得焦點的物件。

(繼承來源 Control)
XYFocusRightNavigationStrategy

取得或設定值,指定用來判斷右導覽之目標元素的策略。

(繼承來源 UIElement)
XYFocusUp

取得或設定當使用者按下方向板 (D 鍵) 時取得焦點的物件。

(繼承來源 Control)
XYFocusUpNavigationStrategy

取得或設定值,指定用來判斷向上流覽目標元素的策略。

(繼承來源 UIElement)

方法

AddHandler(RoutedEvent, Object, Boolean)

加入所指定路由事件的路由事件處理常式,會將此處理常式加入目前項目的處理常式集合中。 將 handledEventsToo 指定為 true ,以叫用提供的處理常式,即使事件是在其他地方處理也一樣。

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

嘗試設定控制項的焦點。

(繼承來源 Control)
GetAnimationBaseValue(DependencyProperty)

傳回針對相依性屬性所建立的任何基底值,如果動畫未使用中,則會套用。

(繼承來源 DependencyObject)
GetBindingExpression(DependencyProperty)

會傳回代表指定屬性上系結的 BindingExpression

(繼承來源 FrameworkElement)
GetChildrenInTabFocusOrder()

可讓 UIElement 子類別公開參與 Tab 焦點的子專案。

(繼承來源 UIElement)
GetTemplateChild(String)

擷取具現化 ControlTemplate 視覺化樹狀結構中的具名專案。

(繼承來源 Control)
GetValue(DependencyProperty)

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

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

在衍生類別中實作時,可在程式碼中啟用控制項範本的個別狀態建構視覺化樹狀結構,而不是在控制項啟動時載入所有狀態的 XAML。

(繼承來源 FrameworkElement)
Hide()

隱藏對話方塊。

InvalidateArrange()

使 UIElement的排列狀態 (配置) 失效。 失效之後, UIElement 會更新其版面配置,這會以非同步方式發生。

(繼承來源 UIElement)
InvalidateMeasure()

使 UIElement的度量狀態 (配置) 失效。

(繼承來源 UIElement)
InvalidateViewport()

使用來計算有效檢視區的UIElement檢視區狀態失效。

(繼承來源 FrameworkElement)
Measure(Size)

匯報UIElementDesiredSize。 一般而言,實作其版面配置子系之自訂配置的物件會從自己的 MeasureOverride 實作呼叫此方法,以形成遞迴版面配置更新。

(繼承來源 UIElement)
MeasureOverride(Size)

提供配置週期的「量值」傳遞行為。 類別可以覆寫這個方法,以定義自己的「量值」傳遞行為。

(繼承來源 FrameworkElement)
OnApplyTemplate()

每當應用程式程式碼或內部進程 (,例如重建版面配置傳遞) 呼叫 ApplyTemplate時叫用。 在最簡單的詞彙中,這表示方法只會在應用程式中顯示 UI 元素之前呼叫。 覆寫這個方法,以影響類別的預設範本後邏輯。

(繼承來源 FrameworkElement)
OnBringIntoViewRequested(BringIntoViewRequestedEventArgs)

在 BringIntoViewRequested事件發生之前呼叫。

(繼承來源 UIElement)
OnCharacterReceived(CharacterReceivedRoutedEventArgs)

CharacterReceived 事件發生之前呼叫。

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

當 Content屬性的值變更時叫用。

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

當 ContentTemplate屬性的值變更時叫用。

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

ContentTemplateSelector 屬性的值變更時叫用。

(繼承來源 ContentControl)
OnCreateAutomationPeer()

在衍生類別中實作時,會傳回 Microsoft 消費者介面自動化 基礎結構的類別特定AutomationPeer實作。

(繼承來源 UIElement)
OnDisconnectVisualChildren()

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

(繼承來源 UIElement)
OnDoubleTapped(DoubleTappedRoutedEventArgs)

DoubleTapped 事件發生之前呼叫。

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

ManipulationInertiaStarting 事件發生之前呼叫。

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

PointerReleased 事件發生之前呼叫。

(繼承來源 Control)
OnPointerWheelChanged(PointerRoutedEventArgs)

PointerWheelChanged 事件發生之前呼叫。

(繼承來源 Control)
OnPreviewKeyDown(KeyRoutedEventArgs)

PreviewKeyDown 事件發生之前呼叫。

(繼承來源 Control)
OnPreviewKeyUp(KeyRoutedEventArgs)

PreviewKeyUp 事件發生之前呼叫。

(繼承來源 Control)
OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)

在應用程式中處理 鍵盤快速鍵 (或快速鍵) 之前呼叫。 每當應用程式程式碼或內部進程呼叫 ProcessKeyboardAccelerators時叫用。 覆寫此方法以影響預設加速器處理。

(繼承來源 UIElement)
OnRightTapped(RightTappedRoutedEventArgs)

RightTapped 事件發生之前呼叫。

(繼承來源 Control)
OnTapped(TappedRoutedEventArgs)

選事件發生之前呼叫。

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

從控制項的控制項界限釋放焦點,該控制項具有遊戲台/遠端互動 () 。

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

啟始拖放作業。

(繼承來源 UIElement)
StopAnimation(ICompositionAnimationBase)

停止專案上的指定動畫。

(繼承來源 UIElement)
TransformToVisual(UIElement)

傳回轉換物件,這個物件可用來將 座標從 UIElement 轉換成指定的物件。

(繼承來源 UIElement)
TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)

嘗試搜尋 UIElement 的整個視覺化樹狀結構,以叫用 鍵盤快速鍵 (或快速鍵)

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

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

(繼承來源 DependencyObject)
UpdateLayout()

確保 UIElement 子物件的所有位置都已針對版面配置正確更新。

(繼承來源 UIElement)

事件

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

當焦點從遊戲台/遠端互動 () 的控制項界限釋放時發生。

(繼承來源 Control)
FocusEngaged

發生于控制項界限內限制焦點時, (遊戲台/遠端互動) 。

(繼承來源 Control)
GettingFocus

發生于 UIElement 收到焦點之前。 此事件會同步引發,以確保事件反升時不會移動焦點。

(繼承來源 UIElement)
GotFocus

發生于 UIElement 收到焦點時。 這個事件會以非同步方式引發,因此焦點可以在反升完成之前再次移動。

(繼承來源 UIElement)
Holding

發生于此元素的點擊測試區域上發生未處理的 保留 互動時。

(繼承來源 UIElement)
IsEnabledChanged

發生于 IsEnabled 屬性變更時。

(繼承來源 Control)
KeyDown

發生于 UIElement 有焦點時按下鍵盤按鍵時。

(繼承來源 UIElement)
KeyUp

發生于 UIElement 有焦點時放開鍵盤按鍵時。

(繼承來源 UIElement)
LayoutUpdated

發生于視覺化樹狀結構的版面配置變更時,因為配置相關屬性變更值或重新整理版面配置的其他動作。

(繼承來源 FrameworkElement)
Loaded

發生于 架構Element 已建構並新增至物件樹狀結構,並準備好進行互動時。

(繼承來源 FrameworkElement)
Loading

FrameworkElement 開始載入時發生。

(繼承來源 FrameworkElement)
LosingFocus

發生于 UIElement 失去焦點之前。 此事件會同步引發,以確保事件反升時不會移動焦點。

(繼承來源 UIElement)
LostFocus

發生于 UIElement 失去焦點時。 這個事件會以非同步方式引發,因此焦點可以在反升完成之前再次移動。

(繼承來源 UIElement)
ManipulationCompleted

發生于 UIElement 上的操作完成時。

(繼承來源 UIElement)
ManipulationDelta

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

(繼承來源 UIElement)
ManipulationInertiaStarting

在操作和慣性開始的時候,只要輸入裝置不與 UIElement 物件接觸便發生。

(繼承來源 UIElement)
ManipulationStarted

當輸入裝置開始在 UIElement 進行操作時發生。

(繼承來源 UIElement)
ManipulationStarting

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

(繼承來源 UIElement)
NoFocusCandidateFound

發生于使用者嘗試透過定位鍵或方向箭號 (移動焦點時) ,但焦點不會移動,因為沒有在移動方向找到焦點候選項目。

(繼承來源 UIElement)
Opened

在開啟對話方塊之後發生。

PointerCanceled

發生于讓連絡人異常失去連絡人的指標時。

(繼承來源 UIElement)
PointerCaptureLost

發生于這個專案先前保留的指標擷取移至另一個專案或其他地方時。

(繼承來源 UIElement)
PointerEntered

發生于指標進入這個專案的點擊測試區域時。

(繼承來源 UIElement)
PointerExited

發生于指標離開這個專案的點擊測試區域時。

(繼承來源 UIElement)
PointerMoved

當指標在指標保留在這個專案的點擊測試區域中時移動時發生。

(繼承來源 UIElement)
PointerPressed

發生于指標裝置在這個專案內起始 Press 動作時。

(繼承來源 UIElement)
PointerReleased

發生于先前起始 按下 動作的指標裝置放開時,同時在此元素內。 請注意, 按下動作的 結尾不保證會引發 PointerReleased 事件;其他事件可能會改為引發。 如需詳細資訊,請參閱。

(繼承來源 UIElement)
PointerWheelChanged

發生于指標滾輪的差異值變更時。

(繼承來源 UIElement)
PreviewKeyDown

UIElement 有焦點時按下鍵盤按鍵時發生。

(繼承來源 UIElement)
PreviewKeyUp

發生于 UIElement 有焦點時放開鍵盤按鍵時。

(繼承來源 UIElement)
PrimaryButtonClick

在點選主要按鈕之後發生。

ProcessKeyboardAccelerators

發生于按下 鍵盤快速鍵 (或快速鍵) 時。

(繼承來源 UIElement)
RightTapped

發生于在指標位於 元素上方時發生右鍵輸入回應時。

(繼承來源 UIElement)
SecondaryButtonClick

發生于點選次要按鈕之後。

SizeChanged

發生于FrameworkElement上的ActualHeightActualWidth屬性值變更時。

(繼承來源 FrameworkElement)
Tapped

發生于未處理的 選互動發生于這個專案的點擊測試區域。

(繼承來源 UIElement)
Unloaded

當這個物件不再連接到主要物件樹狀結構時發生。

(繼承來源 FrameworkElement)

適用於

另請參閱