SystemBackdrop クラス

定義

マイカやアクリルなどの素材をレンダリングするために使用されるカスタム システム背景の基本クラス。

public ref class SystemBackdrop : DependencyObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SystemBackdrop : DependencyObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class SystemBackdrop : DependencyObject
Public Class SystemBackdrop
Inherits DependencyObject
継承
Object Platform::Object IInspectable DependencyObject SystemBackdrop
派生
属性

この例では、 MicaController を使用して実装されるカスタム システムの背景クラスを示します。

ベース の OnTargetConnected メソッドを呼び出すと、 GetDefaultSystemBackdropConfiguration によって返される既定の構成オブジェクトが初期化され、この SystemBackdrop インスタンスに影響する環境の変更 (で connectedTarget, XamlRoot指定) が反映されます。

このページの例では、インスタンスの共有 MicaSystemBackdrop (例: ) はサポートされていませんが、このような共有は可能であり、 Window1.SystemBackdrop = Window2.SystemBackdrop = myMicaSystemBackdrop組み込み MicaBackdrop および DesktopAcrylicBackdrop 資料でサポートされています。 カスタム マテリアルで共有を実装するには、バッキング ISystemBackdropController ストレージをベクター化して、使用コンテキストごとに個別のインスタンスを保持します (たとえば、 で connectedTargetキー付けされたマップを使用)。 SystemBackdropGetDefaultSystemBackdropConfiguration によって返される関連付けられている既定の構成オブジェクトも同様にベクター化され、構成が共有されている場合に各使用コンテキストがSystemBackdrop反映されます。

<Window
    ... >
    <Window.SystemBackdrop>
        <local:MicaSystemBackdrop/>
    </Window.SystemBackdrop>

    <!-- XAML content -->

</Window>
public class MicaSystemBackdrop : SystemBackdrop
{
    MicaController micaController;

    protected override void OnTargetConnected(ICompositionSupportsSystemBackdrop connectedTarget, XamlRoot xamlRoot)
    {
        // Call the base method to initialize the default configuration object.
        base.OnTargetConnected(connectedTarget, xamlRoot);

        // This example does not support sharing MicaSystemBackdrop instances.
        if (micaController is not null)
        {
            throw new Exception("This controller cannot be shared");
        }

        micaController = new MicaController();
        // Set configuration.
        SystemBackdropConfiguration defaultConfig = GetDefaultSystemBackdropConfiguration(connectedTarget, xamlRoot);
        micaController.SetSystemBackdropConfiguration(defaultConfig);
        // Add target.
        micaController.AddSystemBackdropTarget(connectedTarget);
    }

    protected override void OnTargetDisconnected(ICompositionSupportsSystemBackdrop disconnectedTarget)
    {
        base.OnTargetDisconnected(disconnectedTarget);

        micaController.RemoveSystemBackdropTarget(disconnectedTarget);
        micaController = null;
    }
}

注釈

このクラスを使用して、カスタム システムの背景を作成します。 このクラスは直接作成しません (保護されたコンストラクターに注意してください)。 代わりに、カスタム サポートを追加するためにサブクラス化します。 組み込みの派生クラスの 1 つである MicaBackdropDesktopAcrylicBackdrop を使用することもできます。

一般に、カスタム マテリアルは OnTargetConnected をオーバーライドしてバッキング ISystemBackdropController を作成および構成します。これにより、背景領域を埋めるために使用される CompositionBrush が管理されます。 ブラシの最終的なピクセル レンダリングは、次の影響を受ける。

組み込みコントローラー (MicaController および DesktopAcrylicController) では、外観 FallbackColorをカスタマイズするためのパラメーター 、、 LuminosityOpacityTintColorおよび TintOpacityがサポートされています。 組み込みのシステム背景 (MicaBackdropDesktopAcrylicBackdrop) では、マテリアルのカスタマイズ プロパティ (TintOpacityなど) が公開FallbackColorされません。 代わりに、基になる MicaControllerDesktopAcrylicControllerの既定の明るい/暗い構成に依存します。 これらのプロパティをカスタマイズするには、 から SystemBackdrop 派生し、目的のプロパティを公開するカスタム マテリアル クラスを作成します。

コンストラクター

SystemBackdrop()

SystemBackdrop クラスの新しいインスタンスを初期化します。

プロパティ

Dispatcher

常に Windows アプリ SDK アプリで を返しますnull。 代わりに DispatcherQueue を使用してください。

(継承元 DependencyObject)
DispatcherQueue

このオブジェクトが DispatcherQueue 関連付けられている を取得します。 は DispatcherQueue 、コードが UI 以外のスレッドによって開始された場合でも、UI スレッド上の にアクセス DependencyObject できる機能を表します。

(継承元 DependencyObject)

メソッド

ClearValue(DependencyProperty)

依存関係プロパティのローカル値をクリアします。

(継承元 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

依存関係プロパティに対して確立された基本値を返します。これは、アニメーションがアクティブでない場合に適用されます。

(継承元 DependencyObject)
GetDefaultSystemBackdropConfiguration(ICompositionSupportsSystemBackdrop, XamlRoot)

に渡すことができる既定 SystemBackdropConfiguration のオブジェクトを ISystemBackdropControllerWithTargets.SetSystemBackdropConfiguration取得します。

GetValue(DependencyProperty)

DependencyObject から依存関係プロパティの現在の有効な値を返します。

(継承元 DependencyObject)
OnDefaultSystemBackdropConfigurationChanged(ICompositionSupportsSystemBackdrop, XamlRoot)

によって返されるオブジェクトが変更されたときに呼び出されるように、このメソッドを GetDefaultSystemBackdropConfiguration オーバーライドします。 これは、カスタム SystemBackdropConfigurationを使用している場合に便利です。

OnTargetConnected(ICompositionSupportsSystemBackdrop, XamlRoot)

このオブジェクトが有効なコンテナーにアタッチされている場合に呼び出されます。たとえば、 を に Window.SystemBackdrop設定するとします。

OnTargetDisconnected(ICompositionSupportsSystemBackdrop)

このオブジェクトがコンテナーからクリアされると呼び出されます。

ReadLocalValue(DependencyProperty)

ローカル値が設定されている場合は、依存関係プロパティのローカル値を返します。

(継承元 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

この DependencyObject インスタンスの特定の DependencyProperty に対する変更をリッスンするための通知関数を登録します。

(継承元 DependencyObject)
SetValue(DependencyProperty, Object)

DependencyObject の依存関係プロパティのローカル値を設定します。

(継承元 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

RegisterPropertyChangedCallback を呼び出して以前に登録した変更通知を取り消します。

(継承元 DependencyObject)

適用対象

こちらもご覧ください