Table of Contents

Method SetFlagNames

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

SetFlagNames(Func<TEnum, string>)

Set the display names for the flags.

public void SetFlagNames(Func<TEnum, string> nameSelector)

Parameters

nameSelector Func<TEnum, string>

A function that converts enum values to display names

Examples

// Use enum values with custom display names
var flagSelector = new FlagSelector<FlagSelectorStyles>();
flagSelector.SetFlagNames(f => f switch {
     FlagSelectorStyles.ShowNone => "Show None Value",
     FlagSelectorStyles.ShowValueEdit => "Show Value Editor",
     FlagSelectorStyles.All => "Everything",
     _ => f.ToString()
});

Remarks

This method allows changing the display names of the flags while keeping the flag values hard-defined by the enum type.