SystemBackdrop.OnTargetConnected Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called when this object is attached to a valid container; for example, when set on Window.SystemBackdrop
.
protected:
virtual void OnTargetConnected(ICompositionSupportsSystemBackdrop ^ connectedTarget, XamlRoot ^ xamlRoot) = OnTargetConnected;
void OnTargetConnected(ICompositionSupportsSystemBackdrop const& connectedTarget, XamlRoot const& xamlRoot);
protected virtual void OnTargetConnected(ICompositionSupportsSystemBackdrop connectedTarget, XamlRoot xamlRoot);
function onTargetConnected(connectedTarget, xamlRoot)
Protected Overridable Sub OnTargetConnected (connectedTarget As ICompositionSupportsSystemBackdrop, xamlRoot As XamlRoot)
Parameters
- connectedTarget
- ICompositionSupportsSystemBackdrop
The target of the backdrop.
- xamlRoot
- XamlRoot
The XAML root of the backdrop target.
Examples
See SystemBackdrop for the full example.
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);
}
Remarks
This method is called when this SystemBackdrop is attached to a valid container; that is, when it's assigned to the SystemBackdrop property of an object that implements ICompositionSupportsSystemBackdrop, such as Window.SystemBackdrop.
Override this method to create and configure the underlying ISystemBackdropController and its SystemBackdropConfiguration.