- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.9k
 
Experimental interface IBehavior #32350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| 
           Hey there @@stephenquan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an experimental IBehavior interface in .NET MAUI to enable behaviors to be assigned to any object, not just those constrained by the concrete Behavior class. The change allows behaviors to inherit from VisualElement while implementing IBehavior, potentially enabling DynamicResource functionality through access to the ResourceDictionary.
Key Changes:
- Introduces public 
IBehaviorandIBehavior<T>interfaces - Makes 
IAttachedObjectinterface public (previously internal) - Updates 
VisualElement.Behaviorsproperty type fromIList<Behavior>toIList<IBehavior> 
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description | 
|---|---|
| src/Controls/src/Core/VisualElement/VisualElement.cs | Changed Behaviors property type from IList<Behavior> to IList<IBehavior> | 
| src/Controls/src/Core/Interactivity/IBehavior.cs | Added new IBehavior and IBehavior<T> interfaces | 
| src/Controls/src/Core/Interactivity/IAttachedObject.cs | Changed IAttachedObject visibility from internal to public | 
| src/Controls/src/Core/Interactivity/Behavior.cs | Updated Behavior and Behavior<T> to implement IBehavior and IBehavior<T> respectively | 
| src/Controls/src/Core/PublicAPI/*/PublicAPI.Shipped.txt | Updated public API surface to reflect new interfaces and changed signatures | 
91f0884    to
    7a3ed80      
    Compare
  
    | 
           /azp run  | 
    
| 
          
Azure Pipelines successfully started running 3 pipeline(s). | 
    
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Note
DISCLAIMER: This PR is for continued discussion only.
This PR is marked as experimental in the title of the PR. Reviewers please be are aware this should not be merged into a minor version or service release branch.
These changes include a breaking API change as
IAttachedObjectis being made public andVisualElement.Behaviorstype is changing fromIList<Behavior>toIList<IBehavior>.Doing so will enable behaviors to be assigned to anything (including VisualElement).
Pull Request Overview (Generated by Copilot):
This PR introduces an experimental
IBehaviorinterface in .NET MAUI to enable behaviors to be assigned to any object, not just those constrained by the concreteBehaviorclass. The change allows behaviors to inherit fromVisualElementwhile implementingIBehavior, potentially enablingDynamicResourcefunctionality through access to theResourceDictionary.Key Changes (Generated by Copilot):
IBehaviorandIBehavior<T>interfacesIAttachedObjectinterface public (previously internal)VisualElement.Behaviorsproperty type fromIList<Behavior>toIList<IBehavior>Reviewed Changes (Generated by Copilot):
IList<Behavior>toIList<IBehavior>IBehaviorandIBehavior<T>interfacesIAttachedObjectvisibility from internal to publicBehaviorandBehavior<T>to implementIBehaviorandIBehavior<T>respectivelyIssues Fixed
Fixes #