Hello,
I need to show in a comboboxcolumn two properties of a complex object.
To achieve that I used the ValueConverter but it doesn't show me anything.
I attached a sample to show you how I do it.
Regards.
Hello Coso,
In the ComboBoxColumn set the SelectedValuePath and DisplayMemberPath properties.
Let me know if I can provide any further assistance.
Hello Duane,
I set the displamemberpath and selectedValuePath to property "Rue" but it doesn't work either.
Hello Valerie,
Thanks for your response, I tried to use a template column to filter my data but the text that appears in the filter menu dialog is the value corresponding to the key property.
To show what I want I used the ItemTemplate property to bind on the complex object that contain the property specified by the key property.
I tried the method you told me and override the ToString method of the complex object and it works but in my case I can't override this method because I use two template column.
Is there a way to show the converted value in the filter menu.
I attached a sample.
Have you tried using the second option that I suggetsed on Jan 4th:
Another option is to change the ItemTemplate used by the List Box (named itemsBox) in the FilterSelectionControl to use a converter to display the text instead of the int value as is done for the Label. When doing this, the one issue is that the List Box defined in the Style for the FilterSelectionControl is used by all columns, therefore the DataTemplate used for the ItemTemplate would need to change based on the Column. I have attached a sample illustrating this where I use the Loaded Event of the Listbox to set the appropriate DataTemplate.
I had attached a sample previously demonstrating this.
Sincerely,ValerieDeveloper Support Engineer Infragisticswww.infragistics.com/support
I applied your solution to my last sample but it can't work on my case. I used a converter but due to the listbox context we don't have the good object in the converter.
I attached the modified sample.
Yes this method will only work if the column is bound to a complex object which contains all the fields. In your case of only having the first value, your best option may be to rearrange your data so that the values you want to combine are encapsulated into another object and this object is bound to your grid. By the changing data representation in your view model you can easily use the functionality as is in the grid without having to deal with changing styles.
I would recommend creating two complex objects for the columns (implementing IComparable and overriding ToString) and then including object in the items in the list bound to the grid.
Please see modified sample.
Let me know if you have any questions.
Sincerely,
Valerie
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks for your response. But I can't change my data representation, so I tried a last solution by taking one of yours (http://es.infragistics.com/community/forums/p/59382/301863.aspx#301863). It could be a solution for me but I have some troubles with it :
- The filters are not applied correctly,
- The ClearFilters button doesn't works,
- The empty data text appears some times,
- The select all checkbox behavior doesn't works.
What am I doing wrong ?
Thank you for sharing your solution.
Sorry for the late answer, I found a solution by adding a partial class with my data where I put a property that represent what I need.
With this I can use a TextColumn and filter it.
Thanks for your help.
Do you have any other questions on this matter?
The issue is that the underlying value of the cell does not contain the full text that is populated during the display using the converter. Therefore when filtering, the filter is taking the value displayed in the listbox (ex Nom + Prenom) and trying to compare this to the partial value in the cell (ex Nom). Using MVVM the idea would be that your data is represented as it is maintain in your model and then the classes can be refactored in your ViewModel to support binding to the view. This would be your best and simplest approach to resolving this issue.
Please let me know if you have any questions.