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>
繼承
屬性

範例

提示

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

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

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

重要

此範例假設對話框會顯示在 Page中。 To show the dialog from a Window, see the Set the XamlRoot section of the Remarks.

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。 當使用者檢查 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)
{
    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) 。 Also see the Derived controls with WinUI styles section of this article.

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

備註

提示

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

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

標題

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

命令按鈕

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

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

使用 CloseButtonText 屬性可設定安全、非破壞性按鈕的顯示文字。 當使用者執行 Cancel 動作時,也會叫用對話框的關閉按鈕,例如按下 ESC 鍵或按系統返回按鈕。

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

顯示對話框並使用其結果

若要顯示對話框,請呼叫 ShowAsync 方法。 使用這個方法所傳回 的 ContentDialogResult ,來判斷是否有任何按鈕被按下。 如果使用者按下 ESC、系統傳回箭號或遊戲板 B,這個方法的結果會是 None

設定 XamlRoot

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

如果 從 Page 顯示 ContentDialog,您可以將 ContentDialog 的 XamlRoot 屬性設定為 Page () XamlRoot = this.XamlRoot 的 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();
}

關閉對話框

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

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

警告

每個執行緒一次只能開啟一個 ContentDialog。 嘗試開啟兩個 ContentDialog 會擲回例外狀況,即使它們嘗試在不同的應用程式視窗中開啟也一樣。

具有 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>

控件樣式和範本

您可以修改預設 的 StyleControlTemplate ,讓控件具有唯一的外觀。 如需修改控件樣式和範本的相關信息,請參閱 XAML 樣式。 定義控件外觀的預設樣式、範本和資源會包含在檔案中 generic.xaml 。 為了設計目的,generic.xaml會與 Windows 應用程式 SDK NuGet 套件一起安裝。 根據預設,此位置為 \Users\<username>\.nuget\packages\microsoft.windowsappsdk\<version>\lib\uap10.0\Microsoft.UI\Themes\generic.xaml。 不同 SDK 版本的樣式和資源可能會有不同的值。

XAML 也包含資源,可讓您用來修改不同視覺狀態中控件的色彩,而不需修改控件範本。 修改這些資源是慣用的設定屬性,例如 BackgroundForeground。 如需詳細資訊,請參閱 XAML 樣式文章的輕量型樣式一節。

建構函式

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

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

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

一律會在 Windows 應用程式 SDK 應用程式中傳null回 。 請改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

DispatcherQueue取得與這個 物件相關聯的 。 DispatcherQueue表示即使程式代碼是由非UI線程起始,也可以存取 DependencyObject UI線程上的設備。

(繼承來源 DependencyObject)
ElementSoundMode

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

(繼承來源 Control)
ExitDisplayModeOnAccessKeyInvoked

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

(繼承來源 UIElement)
FlowDirection

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

(繼承來源 FrameworkElement)
FocusState

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

(繼承來源 UIElement)
FocusVisualMargin

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

(繼承來源 FrameworkElement)
FocusVisualPrimaryBrush

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

(繼承來源 FrameworkElement)
FocusVisualPrimaryThickness

取得或設定 FrameworkElement 之或Reveal焦點視覺效果的外部框線HighVisibility粗細。

(繼承來源 FrameworkElement)
FocusVisualSecondaryBrush

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

(繼承來源 FrameworkElement)
FocusVisualSecondaryThickness

取得或設定 FrameworkElement 之或Reveal焦點視覺效果的內部框線HighVisibility粗細。

(繼承來源 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 的包含區域是否可以傳回 true 值來進行點擊測試。

(繼承來源 UIElement)
IsHoldingEnabled

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

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

取得所有擷取的指標集合,表示為 Pointer 值。

(繼承來源 UIElement)
PrimaryButtonCommand

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

PrimaryButtonCommandParameter

取得或設定要傳遞至主要按鈕之命令的參數。

PrimaryButtonCommandParameterProperty

取得 PrimaryButtonCommandParameter 相依性屬性的標識碼。

PrimaryButtonCommandProperty

取得 PrimaryButtonCommand 相依性屬性的標識碼。

PrimaryButtonStyle

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

PrimaryButtonStyleProperty

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

PrimaryButtonText

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

PrimaryButtonTextProperty

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

Projection

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

(繼承來源 UIElement)
ProtectedCursor

取得或設定指標在這個專案上方時所顯示的游標。 默認值為 null,表示數據指標沒有變更。

(繼承來源 UIElement)
RasterizationScale

取得值,表示每個檢視圖元的原始 (實體) 像素數目。

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

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

SecondaryButtonStyleProperty

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

SecondaryButtonText

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

SecondaryButtonTextProperty

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

Shadow

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

(繼承來源 UIElement)
Style

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

(繼承來源 FrameworkElement)
TabFocusNavigation

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

(繼承來源 UIElement)
TabIndex

取得或設定值,決定當使用者使用 Tab 鍵瀏覽控制項時,元素接收焦點的順序。

(繼承來源 UIElement)
TabNavigation

取得或設定值,這個值會修改Tabbing和 UIElement.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)
UseLayoutRounding

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

(繼承來源 UIElement)
UseSystemFocusVisuals

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

(繼承來源 UIElement)
VerticalAlignment

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

(繼承來源 FrameworkElement)
VerticalContentAlignment

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

(繼承來源 Control)
Visibility

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

(繼承來源 UIElement)
Width

取得或設定 FrameworkElement 的寬度。

(繼承來源 FrameworkElement)
XamlRoot

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

(繼承來源 UIElement)
XYFocusDown

取得或設定當使用者按下遊戲控制器的 Directional Pad (D-pad) 時取得焦點的物件。

(繼承來源 UIElement)
XYFocusDownNavigationStrategy

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

(繼承來源 UIElement)
XYFocusKeyboardNavigation

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

(繼承來源 UIElement)
XYFocusLeft

取得或設定當用戶在遊戲控制器的 Directional Pad (D-pad) 左鍵時取得焦點的物件。

(繼承來源 UIElement)
XYFocusLeftNavigationStrategy

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

(繼承來源 UIElement)
XYFocusRight

取得或設定當使用者在遊戲控制器的 Directional Pad (D-pad) 上按下滑鼠右鍵時取得焦點的物件。

(繼承來源 UIElement)
XYFocusRightNavigationStrategy

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

(繼承來源 UIElement)
XYFocusUp

取得或設定當使用者按下遊戲控制器的 Directional Pad (D-pad) 時取得焦點的物件。

(繼承來源 UIElement)
XYFocusUpNavigationStrategy

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

(繼承來源 UIElement)

方法

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 的排列狀態 (配置) 失效。 失效之後, 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()

從支援遊戲控制器互動的焦點條件約束中釋放控件, (IsFocusEngaged 為 true) 。

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

啟始拖放作業。

重要

如果使用者以系統管理員身分以提升許可權模式執行應用程式,則不支援。

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

當使用者按下遊戲控制器上的 B/上一頁按鈕時,就會從控件釋放焦點。

(繼承來源 Control)
FocusEngaged

當使用者按下遊戲控制器上的 [A/選取] 按鈕時,就會發生焦點受限於控件。

(繼承來源 Control)
GettingFocus

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

(繼承來源 UIElement)
GotFocus

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

(繼承來源 UIElement)
Holding

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

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

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

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

適用於

另請參閱