Hi there,
I am required to fulfill a requirement where depending on a DataType value in a collection member bound to the Grid, the Itemsource for the ComboBox in the row is changed.
A Simple example would be :
The Grid has 2 Columns. One TextColumn, one ComboBoxColumn. The object bound to the Grid is a collection of Objects containing 3 properties, string Text, Dictionary<int,string> ComboOptions, and string ComboChoice.
A User creates a new Row, and enters a Value into the TextColumn cell of the new row.
This creates an INotifyPropertyChanged event on string Text, which updates the Dictionary<int,string> ComboOptions, and should update the combobox members on the UI with a TwoWay binding.
The User Selects something from the ComboBox and the Value of the KVP is set on the ComboChoice Property.
I hope that is a clear Idea of what I am trying to achieve and I look forward to reading any help you can give.
Many thanks,
Matt.
Hello Matt,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Please let me know if this helps you or I have misunderstood you in some way.
Looking forward for your reply.
Hi, Thanks for the reply,
Unfortunately I was unable to get the example working as I should have mentioned that I am using SL4 with Infragistics V11.1.
Looking at the code though, it appears that the example allows the user to manually change the contents of the Combobox, and this is not the behaviour I require.
The ItemSource of the ComboBox should Change, depending on some other property set in the Grid Row.
So for example, instead of having static Data to populate the Combo Box, my object that is bound to the XamGrid contains a Dictionary FilterOptions.
If the scenario is that we are creating a Person Search application, the User might want to search for "Name" or "DOB".
So there are Three Columns. Search Type : Filter : Value
In the First Column, if the user selects "Name", The underlying Object will automatically populate its Dictionary FilterOptions with the appropriate Filter types for "Name", such as "Equals" and "Like".
If the user selects DOB, the underlying object updates the FilterOptions to be "On", "Before", "After" etc..
This is required to be Row by Row, hence the Object taking care of its own FilterOptions collection, instead of using static data
I hope this is a clearer example!
Thanks,
Matt
You can handle the CellExitingEditMode event of the XamGrid and check if the the Cell is Search Type and if so you can set the ComboBox'ItemsSource in the next Cell. also in order to run the sample I sent you, you should change the Application version to SL 4 and remove the 12.2 assemblies and add the one you have.
Hope this helps you.