Skip to content

GroupedChoice

Record in Oadm.Sdk.Client.Controls · Oadm.Sdk.Client.dll

One entry of a grouped select field (ComboBox with the class grouped): a group header (grey, not selectable) or a choice below it (indented). The theme draws both; the selected choice shows without indent.

public sealed record GroupedChoice(string Text, object? Value, bool IsHeader)

Parameters

  • Text: What the select shows.
  • Value: The item behind a choice; null for a header.
  • IsHeader: A group header that cannot be chosen.

Example

<ComboBox Classes="grouped" ItemsSource="{Binding Choices}" SelectedItem="{Binding SelectedChoice}" />
Choices = GroupedChoice.Build(events, e => e.Group, e => e.Title);
bool IsHeader { get; init; }

A group header that cannot be chosen.

bool IsSelectable { get; }

A choice, not a header.

string Text { get; init; }

What the select shows.

object? Value { get; init; }

The item behind a choice; null for a header.

static IReadOnlyList<GroupedChoice> Build<T>(IEnumerable<T> items, Func<T, string> group, Func<T, string> text)

Headers and choices, groups and the choices in them sorted by text (current culture, case-insensitive).