-
-
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
[need feedback] Create ToggleGroup control #1254
Conversation
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.
First of all: sorry for the delay - I've been a bit snowed under recently.
A few small nits regarding getting property names: nameof
was added after work was started on Avalonia so we don't yet use it everywhere but it's the preferred way of getting a property name as a string.
Regarding the ToggleGroup
control itself: this isn't really what I was imagining. This will only track direct visual children of the ToggleGroup
control, which may be enough but my feeling is that a toggle group should instead start a "scope" for all descendant controls.
I think a better way to start off would be to add a GroupName
property like in WPF.
Once that is added, then there should be a way to "scope" these group names. I'd imagine this could probably be done as an attached property; we could use a control as you've done here but to me an attached property such as ToggleButton.IsGroupScope="true"
would be more similar to other "scope" mechanisms in Avalonia/WPF such as name scopes and focus scopes.
Does that make sense?
public static readonly DirectProperty<ToggleButton, bool> IsCheckedProperty = | ||
AvaloniaProperty.RegisterDirect<ToggleButton, bool>( | ||
"IsChecked", | ||
IsCheckedPropertyName, |
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.
I'd prefer just using nameof(IsChecked)
here.
|
||
public static readonly DirectProperty<ToggleGroup, ToggleButton> SelectedItemProperty = | ||
AvaloniaProperty.RegisterDirect<ToggleGroup, ToggleButton>( | ||
SelectedItemPropertyName, |
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.
Again, use nameof(SelectedItem)
here.
This does't seem to have had any further activity so closing for now. Thanks anyway @jstevans! |
Probably related to the discussion here microsoft/microsoft-ui-xaml#2310. |
This is an early PR for help on next steps -- I saw discussion on #224 that asked for a way to scope groupnames, and it seems like this is what a Control is for.
I'm not extremely familiar with Avalonia/WPF, so could use some feedback on whether this is a good start, and what I need to do to actually have a usable Control (and how to use it).
Ideally, I believe a ToggleGroup should: