2012-10-29 41 views
0

我已经一些代码,得到BindingExpression.UpdateSource()抛出指定转换无效

bindingExpression = ((ComboBox)(((Grid)(control.Content)).Children[0])).GetBindingExpression(ComboBox.SelectedValueProperty); 

组合框是在XAML

<ComboBox Style="{StaticResource UiEditorComboBoxStyle}" 
            Name="comboBox_Business" 
            DisplayMemberPath="Value.Name" 
            SelectedValuePath="Value.BusinessId" 
             > 
           <ComboBox.SelectedValue> 
            <Binding Path="entity.BusinessId" UpdateSourceTrigger="Explicit" ValidatesOnDataErrors="True" ValidatesOnExceptions="True" Mode="TwoWay"> 
             <Binding.ValidationRules> 
              <validators:ValidationRule_SelectedItem NotSelectedErrorMessage="A Business must be selected" 
                       NotSelectedErrorMessageTranslationKey="BusinessMustBeSelected" /> 
             </Binding.ValidationRules> 
            </Binding> 
           </ComboBox.SelectedValue> 
          </ComboBox> 

限定的组合框的结合表达当我打电话

bindingExpression.UpdateSource() 

我得到一个“指定强制转换无效”的异常。我猜这是与财产类型(Guid)有关,但我无法弄清楚如何处理它。

组合框的值绑定到词典

任何指针?

欢呼声,

Ĵ

回答

0

排序,我需要定义一个自定义转换器。