我怎样才能提高单选按钮之间的间距
问题描述:
我找不到任何方法来增加每个单选按钮之间的间距,以配合我界面的格式我怎样才能提高单选按钮之间的间距
这是对我的XAML代码单选按钮
<dxe:ListBoxEdit Name="xrbSplitFreight" Grid.Row="1" Grid.RowSpan="5" FontWeight="Bold" Grid.Column="8" Height="143" VerticalAlignment="center" Width="218" HorizontalAlignment="Left" Grid.ColumnSpan="3" ShowBorder="False" Margin="0,0,0,7">
<dxe:ListBoxEdit.StyleSettings>
<dxe:RadioListBoxEditStyleSettings />
</dxe:ListBoxEdit.StyleSettings>
,这是即时通讯如何填充按钮
private void InitSources()
{
List<String> source = new List<String>();
source.Add("Split Freight");
source.Add("Print Comment");
source.Add("Do Not Split Freight");
xrbSplitFreight.ItemsSource = source;
}
我已经试过无数的属性,如填充和边距属性和它不会改变的间距。
答
尝试使用Margin
到控件之间添加空间。
<RadioButton Margin="5"></RadioButton>
或
<RadioButton Margin="5,0,5,0"></RadioButton>
编辑
检查了这一点。
<ListBox ItemsSource="MyList">
<ListBox.ItemTemplate>
<DataTemplate>
<RadioButton Margin="10" Content="{Binding Value}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
每个RadioButton
是分隔给定的余量。
答
我认为这个问题是你想放置列表框的里面单选按钮。你有没有尝试把它们放入具有垂直方向属性的StackPanel?如果你会尝试你可能能够在它们之间设置边距。
+1
这样做对于动态数量的项目无效。在这里使用列表框非常合理。 –
哪里'DXE:RadioListBoxEditStyleSettings'从何而来? –
什么是'dxe:ListBoxEdit'?似乎这是一个非标准的列表框控件(看起来像DevExpress)。使用标准列表框,您可以使用所需的间距定义您自己的项目模板。 –
是的,我目前正在使用DevExpress,并且我还没有找到一种按照我想要的方式来设计它的方法。 – RickS