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}
Hi rhavlick,
can you explain in details what exactly you are trying to achieve. For example do you really need a dictionary if the values are static? Why having your custom made Key/Value class in list is not good enough ?
Regards
Thanks Konstantin, so for now I just wrote a basic key / value pair class that can be used to bind to these drop downs. Is there any inherint collection in the .NET Framework that would work similar to a key / value collection? Or do you know are there any future plans to add a built-in collection of drop down items to the combo for when you need to set a static list at runtime?
Thanks again Konstantin.
Hi rhavlic,
the problem here is that the KeyValuePair class do not expose set method for it's Value(neither the key) property and combo box needs to be able to set the property it is bound to when the IsEditable flag is set to True.
So if you do not need to add nodes or the AutoComplate functionality you could disable editing. Otherwise you will have to bind to non read-only property.
HTH