Skip to content

Mark ToggleButton.onChecked/onUnchecked/onIndeterminate as Obsolete#484

Draft
Numpsy wants to merge 2 commits intofsprojects:masterfrom
Numpsy:obsolete1
Draft

Mark ToggleButton.onChecked/onUnchecked/onIndeterminate as Obsolete#484
Numpsy wants to merge 2 commits intofsprojects:masterfrom
Numpsy:obsolete1

Conversation

@Numpsy
Copy link
Collaborator

@Numpsy Numpsy commented Feb 7, 2026

They're marked as obsolete in Avalonia 11 and have been removed in 12.
We can mark them as obsolete over here as well, and remove some local uses of them prior to the v12 update so that we have fewer changes to make later.

They're marked as obsolete in Avalonia 11 and have been removed in 12.
We can mark them as obsolete over here as well, and remove some local uses of them prior to the v12 update so that we have fewer changes to make later.
@Numpsy
Copy link
Collaborator Author

Numpsy commented Feb 7, 2026

@Numpsy
Copy link
Collaborator Author

Numpsy commented Feb 7, 2026

Theres a couple of Radio buttons in the Presso samples that could do with changing as well, but I'm out of time for now

RadioButton.horizontalAlignment HorizontalAlignment.Stretch
RadioButton.onChecked (fun _ ->
state.Set { state.Current with water = i }
RadioButton.onIsCheckedChanged(fun args ->
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem the most friendly approach to things.
I wonder if there would be value in doing something like

type RadioButton with

    static member onChecked<'t when 't :> RadioButton>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =

        let onCheckedHandler (args: RoutedEventArgs) =
            match args.Source with
            | :? RadioButton as selection when selection.IsChecked.GetValueOrDefault() = true ->
                func(args)
            | _ -> ()

        AttrBuilder<'t>.CreateSubscription<RoutedEventArgs>(RadioButton.IsCheckedChangedEvent, onCheckedHandler, ?subPatchOptions = subPatchOptions)

to remove some duplication?

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.

1 participant