This topic contains 4 replies, has 2 voices, and was last updated by
January 14, 2018 at 7:11 pm #91441
Has anyone got any suggestions on how to build a single item select checked listbox using a combination of PowerShell and XAML?
I've managed to get a multi-select version working by using a combination of a span panel and a checkbox but i'm finding it almost impossible to get the code wired up to prevent multiple items from being selected.
A read online suggested it might be possible to do it using the observable collections data type but i'm also struggling to get that to work. It seems that you can register and object event for CollectionChanged which will get called when items are added or removed but when I try to create an object event registration for 'PropertyChanged' then PowerShell complains that the event doesn't exist; it's strange because according to the documentation on the data type there should be an event with that name.
I'd really appreciate any suggestions people might have.
January 14, 2018 at 7:13 pm #91442KeymasterPoints: 1,811Rank: Community Hero
A single-item checklist would kind of break UI consistency. By definition, you use checkboxes to indicate that multiple items can be selected. It's considered poor form to break with those visual rules, because it creates a poor user experience.
January 14, 2018 at 7:23 pm #91444
I take your point entirely.
However, my reason for wanting a checked listbox is simply so that it's entirely clear which item is selected and so that a user can also have the option of not making a selection at all; or they can 'un-select' the item they've chosen if it turns out they made a choice in error.
Perhaps you could suggest an alternative method to a checked listbox which might satisfy these needs? 🙂
I don't wish to make this more complex than it needs to be and i'd be only too happy to create an interface which is intuitive and friendly for the end-users to work with.
January 14, 2018 at 7:24 pm #91445KeymasterPoints: 1,811Rank: Community Hero
I'd do a normal select list with a "(none)" option at the top. The convention in Windows is that "no selection" is not a thing; if you explicitly want no action (or whatever), then that's a discrete option in the UI.
January 14, 2018 at 7:27 pm #91447
Good point Don.
I think i'd got my head so stuck into 'checked listbox' mode that I didn't even consider if it made sense after we made a bout of other changes to the UI.
Thanks for setting me back on the right track 🙂
The topic ‘Single item select checked listbox using PowerShell + XAML’ is closed to new replies.