Facebook
Twitter
Pinterest
Tumblr
GitHub
RSS
  • DEV Home
  • Documentation
  • Reference
  • Download
Search Results for

    Show / Hide Table of Contents

    Features: Radio Input

    Enum Value Selection as Radio Group

    All that it takes is to add a SelectShowRadioGroupAttribute to show an enum as a radio group.

    public enum StayOrGo
    {
        [Description("I don't know")]
        DontKnow,
        [Description("I Will stay")]
        Stay,
        [Description("I Will go")]
        Go,
        [Description("I will go later")]
        GoLater,
    }
    
    [DisplayName("Should I stay or should I go?")]
    [SelectShowRadioGroup]
    public StayOrGo StayOrGoValue { get; set; }
    

    Ui Feat2 Select Enum Radio

    Radio Selection from Custom Source

    What's special about radio options is that these can have a primary text and a secondary text which can display the option in more detail.

    List Creation
    public CreateList()
    {
        var radioList = new List<EditorRadioOption>();
    
        radioList.Add(new EditorRadioOption
        {
            Value = 0,
            PrimaryText = "This is Option 1",
            SecondaryText = "What's special about radio options is that these can have a primary text "
                                            + "and a secondary text which can display the option in more detail",
        });
    
        radioList.Add(new EditorRadioOption
        {
            Value = 1,
            PrimaryText = "This is another Option",
            SecondaryText = string.Concat(Enumerable.Repeat("This is a long text which spans over multiple lines. ", 5)),
        });
    
        radioList.Add(new EditorRadioOption
        {
            Value = 0,
            PrimaryText = "This is a a third Option",
            SecondaryText = "But this option is disabled. It cannot be selected at this time for some reason",
            IsEnabled = false,
        });
    
        this.RadioList = radioList;
    }
    
    Properties
    [Browsable(false)]
    public IEnumerable<EditorRadioOption> RadioList { get; set; }
    
    [DisplayName("Choose an Option")]
    [SelectItemsSource(nameof(RadioList))]
    [SelectShowRadioGroup]
    public string RadioSelectionFromCustomList { get; set; }
    
    Result

    Ui Feat2 Select Customlist Radio

    SDK
    On this Page
    Back to Top Copyright 2022 © EMBY LLC. Please see our terms of use and privacy policy.