Skip to content

Conversation

@TheCodeTraveler
Copy link
Collaborator

@TheCodeTraveler TheCodeTraveler commented Dec 8, 2025

Description of Change

This PR removes the DefaultValue property from [BindableProperty] for the following reasons now that it is not longer required thanks to #2987:

  1. Setting the DefaultValue has been the largest source of pain and workarounds in BindablePropertySourceGenerator
  2. The DefaultValue property only supported compile-time constants, while partial property initializer can use static readonly values
    • For example, [BindableProperty(DefaultValue = Colors.Transparent)] would generate a compiler error because Colors.Transparent is public static readonly
  3. Improve the developer experience
    • It's a bit confusing to give developers two ways to initialize / set the default value of the bindable property
    • If we keep BindablePropertyAttribute.DefaultValue, we would need to write an additional Analyzer to generate a compiler error when we detect a developer is using both DefaultValue and the partial property initializer

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard

Additional information

This PR is dependent on #2987 and should not be merged before merging #2987

stephenquan and others added 29 commits December 5, 2025 18:34
…fault_GeneratedCodeDefaultsToUseDefaultValueCreatorMethod`
@ne0rrmatrix
Copy link
Member

Do we want to add tests for most common system types that we will see used? Like DateTime and others? Or add them as we update our sample app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants