Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 26, 2025

This PR addresses a documentation gap by adding a comprehensive example showing how to use both {x:Bind} and {Binding} markup extensions within a reusable Style defined in a Resource Dictionary.

Changes Made

New Section Added: "Mixing {x:Bind} and {Binding} in a reusable Style"

The example demonstrates:

  • A complete ResourceDictionary with code-behind that defines properties for {x:Bind}
  • A Button style that combines both binding types strategically:
    • {Binding} for DataContext-dependent properties (background, foreground, hover colors)
    • {x:Bind} for compile-time known properties (indicator, pressed state)
  • A ViewModel implementing INotifyPropertyChanged for runtime theming
  • Usage examples showing how to apply the style in both UWP and Windows App SDK contexts

Technical Benefits

The example shows developers how to:

  • Leverage the performance benefits of {x:Bind} for static/compile-time properties
  • Use the flexibility of {Binding} for dynamic/runtime scenarios
  • Create truly reusable styles that support both approaches
  • Implement runtime theming while maintaining optimal performance

Files Modified

  • uwp/data-binding/data-binding-in-depth.md - Added example for UWP applications
  • hub/apps/develop/data-binding/data-binding-in-depth.md - Added example for Windows App SDK applications

The documentation now provides the missing guidance requested by developers who want to understand how to effectively combine both binding approaches in reusable XAML resources.

Fixes #4609.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: alvinashcraft <73072+alvinashcraft@users.noreply.github.com>
Copy link
Contributor

Learn Build status updates of commit fa61254:

⚠️ Validation status: warnings

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@Copilot Copilot AI changed the title [WIP] x:Bind in a style defined in Resource dictionary Add example of mixing {x:Bind} and {Binding} in reusable Styles Aug 26, 2025
Copilot finished work on behalf of alvinashcraft August 26, 2025 19:29
Copy link
Contributor

Learn Build status updates of commit 3863ed4:

✅ Validation status: passed

File Status Preview URL Details
hub/apps/develop/data-binding/data-binding-in-depth.md ✅Succeeded
uwp/data-binding/data-binding-in-depth.md ✅Succeeded

For more details, please refer to the build report.

Copy link
Contributor

Learn Build status updates of commit 828fc06:

✅ Validation status: passed

File Status Preview URL Details
hub/apps/develop/data-binding/data-binding-in-depth.md ✅Succeeded
uwp/data-binding/data-binding-in-depth.md ✅Succeeded

For more details, please refer to the build report.

@alvinashcraft alvinashcraft marked this pull request as ready for review August 26, 2025 19:47
@alvinashcraft alvinashcraft merged commit 2095d51 into docs Aug 27, 2025
2 checks passed
@alvinashcraft alvinashcraft deleted the copilot/fix-4609 branch August 27, 2025 13:30
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.

x:Bind in a style defined in Resource dictionary

2 participants