Single item select checked listbox using PowerShell + XAML

This topic contains 4 replies, has 2 voices, and was last updated by  Peter West 4 months, 1 week ago.

  • Author
    Posts
  • #91441

    Peter West
    Participant

    Hi,

    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.

    Thanks

    Pete

  • #91442

    Don Jones
    Keymaster

    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.

  • #91444

    Peter West
    Participant

    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? 🙂

    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.

    Thanks

    Pete

  • #91445

    Don Jones
    Keymaster

    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.

  • #91447

    Peter West
    Participant

    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 🙂

    Pete

You must be logged in to reply to this topic.