<TelerikRadioGroup Data="@RadioData"
@bind-Value="@ChosenOption"
ValueField="Child.Id"
TextField="Child.Text">
</TelerikRadioGroup>
@code {
public int ChosenOption { get; set; }
public class Parent<TItem>
{
public TItem Content { get; set; }
public Parent(TItem item)
{
Content = item;
}
}
public class Child
{
public int Id { get; set; }
public string Text { get; set; }
public Child(int id, string text)
{
Id = id;
Text = text;
}
}
public List<Parent<Child>> RadioData { get; set; } = new List<Parent<Child>>();
protected override void OnInitialized()
{
RadioData.Add(new Parent<Child>(new Child(0, "Item 1")));
RadioData.Add(new Parent<Child>(new Child(1, "Some text")));
RadioData.Add(new Parent<Child>(new Child(2, "Other text")));
RadioData.Add(new Parent<Child>(new Child(3, "Third text")));
base.OnInitialized();
}
}I would like to have the option (similar to AJAX controls radiobuttonlist) to specify the number of columns a RadioGroup has. This would allow it to be evenly formatted no matter the text width and the ordering to go top to bottom and then left to right like below.
Since your control does not allow you to manually define child items, it becomes less useful than the built in InputRadioGroup control provided by Microsoft which allows me to set up the items and styling myself, which is what I use instead.