-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Convert various DirectProperty
definitions to StyledProperty
#10370
Convert various DirectProperty
definitions to StyledProperty
#10370
Conversation
You can test this PR using the following package version. |
1fb88fa
to
775d33f
Compare
You can test this PR using the following package version. |
775d33f
to
107cb67
Compare
You can test this PR using the following package version. |
Looks like |
I was hoping that would prove to be a temporary glitch, but it apparently is not. Is there a guide somewhere for setting up Appium locally? |
@tomenscape Looks like the best guide is the Readme under tests/Avalonia.IntegrationTests.Appium. ToggleButton changes are likely the root. However, the only thing I see that could be wrong is SetCurrentValue(). Otherwise, there is an extension method GetIsChecked() in ElementExtensions.cs which might be the issue. Honestly not sure how this works to begin with though. |
It does indeed look like checkboxes are broken ;) 3MvZNjMR4s.mp4 |
Well, that's interesting. However, it might be an issue with SetCurrentValue() and derived controls. It looks similar to the ColorPicker issues as well. |
Yeah, I don't have time to investigate last night. Will try to work out what's happening if no-one else gets there first :) |
Another problem I've noticed: inspecting a control in DevTools breaks the margin on certain controls: tFmW4aZ3s3.mp4Probably caused by the change to |
Yep, looks like |
Opened #10497 with a fix. |
107cb67
to
dcaaad7
Compare
That PR also fixes the |
You can test this PR using the following package version. |
Apologies for the delay on this, PRs are being help up by problems with our CI. Waiting for the |
You can test this PR using the following package version. |
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.
All unit and integration tests now passing, did a manual test with ControlCatalog and didn't see any problems so I say we're ready to go!
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.
Oh wait, I just took a final look and it seems like non-Control
properties are still converted to StyledProperty
. In the comment in #10370 (comment) I meant that I think we should remove these changes for now, as
- They can't really be styled anyway
- Some of the properties are collection types, which are problematic in combination with styling currently (see below)
Changed Button.IsPressed to a read-only DirectProperty
68086ee
to
f36cf7e
Compare
You can test this PR using the following package version. |
What does the pull request do?
This is the first change which directly addresses #9944, the end goal of which is to avoid public
DirectProperty
setters on types which derive fromStyledElement
.What is the current behavior?
See #9944.
What is the updated/expected behavior with this PR?
This PR refactors a large batch of properties from
DirectProperty
toStyledProperty
. The newSetCurrentValue
method is now used to set the value of refactored properties, where necessary.Only properties which could be easily changed are included. Properties with complicated behaviours will be handled in smaller PRs.
There are some additional changes:
DirectProperty
was not changed toStyledProperty
, but instead had its setter removed.StyledElement.TemplatedParent
is a notable example: the CLR property has an internal setter, but this could be evaded by callingSetValue(TemplatedParentProperty)
. Closing backdoors like these reduces Avalonia's API surface.TemplateBinding
now usesSetCurrentValue
.AddOwner
methods now accept a metadata object, mirroring WPF's API.ComboBox.SelectionBoxItem
has been changed from a protected property to a public property with a protected setter. This better reflects the accessibility of theDirectProperty
it wraps around.Button.IsPressed
has been changed to a read-onlyDirectProperty
, and an old test that tried to data bind to it has been removed.Breaking changes
AddOwner
on a refactored property will have to refactor their controls to match the new property type.DirectProperty
setters that this PR removes will have to stop hacking Avalonia. 🤡Obsoletions / Deprecations
None
Fixed issues
Part of #9944