IXamlSourceTransparency.IsBackgroundTransparent property

Definition

Namespace: Windows.UI.Xaml

Gets or sets a value that specifies whether the background of all DesktopWindowXamlSource objects on the current thread is transparent.

[uuid(06636c29-5a17-458d-8ea2-2422d997a922)]
interface IXamlSourceTransparency
{
    Boolean IsBackgroundTransparent;
};

Property Value

Boolean

true if the window background is transparent; otherwise, false.

Windows requirements

Device familyWindows 10 (introduced in 10.0.17763.0)

Examples

This example shows the DesktopWindowXamlSource objects being configured to have a transparent background.

// Make all DesktopWindowXamlSource objects on this
// thread have a transparent background.
var xamlSourceTransparency = (IXamlSourceTransparency)Window.Current;
xamlSourceTransparency.IsBackgroundTransparent = true;

With IsBackgroundTransparent set to true, if the following is set as the content of an island, the first column will show the content of the host but the second column will be white.

<Grid ColumnDefinitions="Auto,*">
    <TextBlock>Column 0 text</TextBlock>

    <Border Grid.Column="1" Background="White">
        <TextBlock>Column 1 text</TextBlock>
    </Border>
</Grid>

Remarks

The DesktopWindowXamlSource class is used to host Xaml in another app. For example, you can use this to host some Xaml content in a WPF or WinForms app. See Host WinRT XAML controls in desktop apps (XAML Islands) for more info.

By default, the XAML content has an opaque background, meaning that it's not possible to have any of the host content behind the XAML show through. (In WinUI3, this behavior is changed; the XAML always has a transparent background.)

Set this property to true to give all DesktopWindowXamlSource objects on the current thread a transparent background.

This interface is retrieved from a XAML Window.

Note

Setting this property to true in a XAML UWP app will cause a XAML Window to be transparent as well when it's in full screen mode (when you've called ApplicationView.TryEnterFullScreenMode).