Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
610
Binding To A Dictionary / KeyValuePair
posted

 

 

 

 

 

Hello,

  I have a bunch of XamComboEditors that will have a static list of items in them set at design time.  Maybe there is an easier way, but I was hoping to use a KeyValuePair object so for each combo I don't have to create a seperate class for them to bind to them.  So here is an example of how I"m populating a combo.

Dim Dict As New System.Collections.Generic.Dictionary(Of Integer, String)
Dict.Add(1, "A")
Dict.Add(2, "B")
Dict.Add(3, "C")

Me.XamComboEditor1.DisplayMemberPath = "Value"
Me.XamComboEditor1.ItemsSource = Dict.ToList

It loads fine, but then when the control looses focus, it generates the below error.  Is there a way to get this to work, or is there a better way to bind items to the combo so they can be set at design time?

Thanks

Here is the error it's generating:

{System.ArgumentException: Argument types do not match
   at System.Linq.Expressions.Expression.Constant(Object value, Type type)
   at Infragistics.FilterContext`1.CreateStringExpression[TDataObjectType](String fieldName, Expression`1 booleanStringExpression)
   at Infragistics.FilterContext`1.CreateStartsWithCaseInsensitiveExpression[TDataObjectType](String fieldName, String value)
   at Infragistics.FilterContext`1.CreateCaseInsensitiveStringBLOCKED EXPRESSION}