我有以下组合框
<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 是一个字符串