Single item select checked listbox using PowerShell + XAML


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.



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.

Hi Don,

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? :slight_smile:

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.



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.

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 :slight_smile: