Can RadioButtons be arranged at intervals?
Can RadioButtons be arranged at intervals?
The current method is similar to Grid, but it is not good when the length of the items is different.
Sorry, i didn't understand
The current arrangement is similar to this:
But I would prefer this way:
That is to say, we hope the arrangement method is mainly based on item intervals, rather than fixed widths of item
Try setting the MinWidth property to 0 on the radio buttons
After setting the MinWidth property to 0,the problem still exists. You can test the app example by setting radio button content of different lengths size ,like the abrove.
Check this code:
<ikw:SimpleStackPanel HorizontalAlignment="Center" VerticalAlignment="Center"
Spacing="15" Orientation="Horizontal">
<FrameworkElement.Resources>
<Style TargetType="RadioButton" BasedOn="{StaticResource {x:Static ui:ThemeKeys.DefaultRadioButtonStyleKey}}">
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Background" Value="AliceBlue"/>
</Style>
</FrameworkElement.Resources>
<RadioButton Content="Radio"/>
<RadioButton Content="Radio Button"/>
<RadioButton Content="Station"/>
<RadioButton Content="Button Radio"/>
</ikw:SimpleStackPanel>
Just using RadioButton is definitely not a problem.however, there are issues with using the RadioButtons control
<ui:RadioButtons HorizontalAlignment="Left" VerticalAlignment="Top" SelectedIndex="{Binding Group2SelectedIndex}" MaxColumns="15"> <RadioButton Content="Option 1 length"/> <RadioButton Content="Option 2"/> <RadioButton Content="Option 3 length"/> <RadioButton Content="Option 4"/> <RadioButton Content="Option 5"/> </ui:RadioButtons>
No, you can't do that. Please see the source code of ui:RadioButtons (https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/RadioButtons/RadioButtons.xaml).
Inside the component a UniformGrid-based panel is used for layout, and this makes your idea not possible. Alternately, a better idea is to use ItemsControl and RadioButton control.
If there's anything else, feel free to reply, reopen this issue, or create a new issue!