0

我有以下组合框

<ComboBox Grid.Column="1" HorizontalAlignment="Stretch"
                              Text="{Binding GroupInvoicing.AdminInvoiceBreakdownMembership}" 
                              SelectedValuePath="Tag" SelectedValue="{Binding Path=GroupInvoicing.AdminInvoiceBreakdownMembership}">
                        <ComboBoxItem Content="None" Tag="N" />
                        <ComboBoxItem Content="Level of Cover" Tag="L" />
                        <ComboBoxItem Content="Members" Tag="M" />
                        <ComboBoxItem Content="Payment Type" Tag="P" />
                        <ComboBoxItem Content="Work Area" Tag="W" />
                    </ComboBox>

尽管 GroupInvoicing.AdminInvoiceBreakdownMembership 以“L”返回,但它不选择对应的文本,也不让我选择任何内容

d:DataContext="{d:DesignInstance ViewModels:CompanyInvoiceConfigAdminViewModel}" 

在视图模型中我有

    public GroupInvoicing GroupInvoicing
    {
        get
        {
            return this.groupInvoicing;
        }

        set
        {
            if (value != null)
            {
                this.groupInvoicing = value;
                this.OnPropertyChanged(() => this.GroupInvoicing);
            }
        }
    }

AdminInvoiceBreakdownMembership 是一个字符串

4

1 回答 1

3

我相信你不能将 Text 和 SelectedValue 绑定到同一个属性。尝试删除文本绑定。

于 2012-07-13T11:47:41.093 回答