Skip to content

Update XamlCompositionBrushBase examples for Windows App SDK - #128

Draft
John Kennedy (GrantMeStrength) with Copilot wants to merge 2 commits into
docsfrom
copilot/fix-wrong-examples-in-xamlcompositionbrushbase
Draft

Update XamlCompositionBrushBase examples for Windows App SDK#128
John Kennedy (GrantMeStrength) with Copilot wants to merge 2 commits into
docsfrom
copilot/fix-wrong-examples-in-xamlcompositionbrushbase

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown

The Microsoft.UI.Xaml.Media.XamlCompositionBrushBase docs still showed UWP-era examples, including Window.Current.Compositor, which is not the right pattern for Windows App SDK/WinUI 3. This updates the samples and links to align with the current API surface.

  • Example code updates

    • Replaced Window.Current.Compositor with CompositionTarget.GetCompositorForCurrentThread()
    • Updated sample type references from Windows.UI.Xaml.* / Windows::UI::* to Microsoft.UI.Xaml.* / Microsoft::UI::*
    • Switched composition types in samples to the Microsoft.UI.Composition equivalents
  • Doc link cleanup

    • Repointed UWP composition/brush links to current Windows apps / Windows App SDK documentation
    • Updated inline API links to the corresponding Microsoft.UI.* reference pages in this repo
  • Sample correctness

    • Corrected the C++/CX BlurAmount dependency property registration to use double::typeid
protected override void OnConnected()
{
    if (CompositionBrush == null)
    {
        var compositor = CompositionTarget.GetCompositorForCurrentThread();
        var backdrop = compositor.CreateBackdropBrush();

        var effectFactory = compositor.CreateEffectFactory(
            graphicsEffect,
            new[] { "Blur.BlurAmount" });

        var effectBrush = effectFactory.CreateBrush();
        effectBrush.SetSourceParameter("backdrop", backdrop);

        CompositionBrush = effectBrush;
    }
}

Copilot AI changed the title [WIP] Fix wrong examples in XamlCompositionBrushBase Update XamlCompositionBrushBase examples for Windows App SDK Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong examples in Microsoft.UI.Xaml.Media.XamlCompositionBrushBase

2 participants