gpt4 book ai didi

c# - 如何增加单选按钮之间的间距

转载 作者:行者123 更新时间:2023-12-05 02:19:57 24 4
gpt4 key购买 nike

我找不到任何方法来增加每个单选按钮之间的间距以匹配我的界面格式

enter image description here

这是我的单选按钮 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;
}

我已经尝试了很多属性,例如 padding 和 margin 属性,但它不会改变间距。

最佳答案

如果我没理解错的话,您想要的是增加每个单选框与其文本之间的间距,使其与上面的复选框与其文本之间的间距相匹配。

这里的问题是单选框内容没有边距属性来独立于单选框移动它。幸运的是,在 WPF 中,您几乎可以将每个控件封装在任何其他控件中。所以解决方案不是使用简单的文本,而是使用可以显示文本并具有如下边距属性的控件:

<RadioButton GroupName="GroupName">
<RadioButton.Content>
<TextBlock Text="Option 1" Margin="5 0 0 0"/>
</RadioButton.Content>
</RadioButton>

关于c# - 如何增加单选按钮之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40678599/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com