【问题标题】:SL4 radiobutton databindingSL4 单选按钮数据绑定
【发布时间】:2016-01-17 01:59:11
【问题描述】:

我有两组独立的单选按钮(在运行时填充)。我面临的问题是这两个组表现为一个组,即从一组中选择某些内容会从另一组中取消选择所选项目。

                    <ScrollViewer>
                        <ItemsControl ItemsSource="{Binding Path=AvailableX}" />
                    </ScrollViewer>
                    <ScrollViewer>
                        <ItemsControl ItemsSource="{Binding Path=AvailableY}" />
                    </ScrollViewer>


    public ObservableCollection<RadioButton> AvailableX
    {
        get
        {
            return _availableX;
        }
        set
        {
            _availableX = value;
        }
    }

    public ObservableCollection<RadioButton> AvailableY
    {
        get
        {
            return _availableY;
        }
        set
        {
            _availableY = value;
        }
    }

.....
.....

foreach (var x in _properties)
{
    AvailableX.Add(new RadioButton() { Content = x.ToString() });
    AvailableY.Add(new RadioButton() { Content = x.ToString() });
}

【问题讨论】:

    标签: silverlight data-binding radio-button


    【解决方案1】:

    尝试设置组名:

    new RadioButton() { Content = x.ToString(), GroupName = "X" });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-17
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 2012-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多