Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 990863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:00:41+00:00 2026-05-16T06:00:41+00:00

Are there any controls that can dynamically create a group of radio buttons from

  • 0

Are there any controls that can dynamically create a group of radio buttons from a list of objects? Something similar to the CheckedBoxList control, but with mutually exclusive selection. This question points out this control doesn’t exist natively for WinForms but are there any third party controls that do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:00:41+00:00Added an answer on May 16, 2026 at 6:00 am

    Control vendors can’t make any money with controls like that. Here’s some code to get your started:

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    class RadioList : ListBox {
        public event EventHandler SelectedOptionChanged;
    
        public RadioList() {
            this.DrawMode = DrawMode.OwnerDrawFixed;
            this.ItemHeight += 2;
        }
        public int SelectedOption {
            // Current item with the selected radio button
            get { return mSelectedOption; }
            set { 
                if (value != mSelectedOption) {
                    Invalidate(GetItemRectangle(mSelectedOption));
                    mSelectedOption = value; 
                    OnSelectedOptionChanged(EventArgs.Empty);
                    Invalidate(GetItemRectangle(value));
                }
            }
        }
        protected virtual void OnSelectedOptionChanged(EventArgs e) {
            // Raise SelectOptionChanged event
            EventHandler handler = this.SelectedOptionChanged;
            if (handler != null) handler(this, e);
        }
        protected override void OnDrawItem(DrawItemEventArgs e) {
            // Draw item with radio button
            using (var br = new SolidBrush(this.BackColor))
                e.Graphics.FillRectangle(br, e.Bounds);
            if (e.Index < this.Items.Count) {
                Rectangle rc = new Rectangle(e.Bounds.Left, e.Bounds.Top, e.Bounds.Height, e.Bounds.Height);
                ControlPaint.DrawRadioButton(e.Graphics, rc,
                    e.Index == SelectedOption ? ButtonState.Checked : ButtonState.Normal);
                rc = new Rectangle(rc.Right, e.Bounds.Top, e.Bounds.Width - rc.Right, e.Bounds.Height);
                TextRenderer.DrawText(e.Graphics, this.Items[e.Index].ToString(), this.Font, rc, this.ForeColor, TextFormatFlags.Left);
            }
            if ((e.State & DrawItemState.Focus) != DrawItemState.None) e.DrawFocusRectangle();
        }
        protected override void OnMouseUp(MouseEventArgs e) {
            // Detect clicks on the radio button
            int index = this.IndexFromPoint(e.Location);
            if (index >= 0 && e.X < this.ItemHeight) SelectedOption = index;
            base.OnMouseUp(e);
        }
        protected override void OnKeyDown(KeyEventArgs e) {
            // Turn on option with space bar
            if (e.KeyData == Keys.Space && this.SelectedIndex >= 0) SelectedOption = this.SelectedIndex;
            base.OnKeyDown(e);
        }
        private int mSelectedOption;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to make two controls that are in different containers the
In a Windows Forms app is there any control that allow to have a
Good morning all. Is there any jsf control that escapes the html tags? Imagine
Is there any WPF control (commercial or not) that integrates well with the MVVM
Is there any wizard controls available for ASP.NET 1.1???? Please let me know if
Is there any freeware library (controls) for ASP MVC implementing posting and displaying comments?
Is there any way to render ASP.net MVC controls or code directly within a
Is there any way to use server controls in ASP.NET MVC? Specifically I need
Are there any winforms source code editor controls available with color coding ? pref.
Is there any way to uniquely identify controls using Accessibility? Once control is identified

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.