Hi,
I have an ig:xamcomboeditor on the screen with a list of documents(these documents can have different revisions). The combo editor allows multiple selections and has check boxes property enabled. It also has an option added dynamically for Select All. When I check the box against Select All, the system needs to find a list of latest revision documents in combo editor and check the boxes against it and update the selected items for the combo editor.This has to be done dynamically. The user can also uncheck any document if he decidedes not to use it. At that moment, the select All should be unchecked as well. Any ideas on how this can be implemented. I tried to get it working by using the combobox1_SelectionChanged. But it doesnt ticks the check boxes if select all is checked. And if I try to select "Select All" again, it gives me an error.
Hello,
Thank you for your post.
Please correct me if my following impression is incorrect, but currently I am under the impression that you have a XamComboEditor with multiple selection and inside it, you have an item that acts as a "Select All" type of item. When clicking this item, you want all of the items in the XamComboEditor to become selected, and if you decide to deselect one of those items, you want the "Select All" item to become unselected. Have I understood your requirement correctly?
If so, I have gone off of the above impression and have created a sample project with this functionality. In the project, I handle the SelectionChanged event of the XamComboEditor and begin by checking the e.AddedItems collection of the event arguments. If the added item is the "Select All" item, then all of the items in the XamComboEditor get selected. The next check is for the e.RemovedItems collection of the event arguments. If the item that was deselected was not the "Select All" item, then I make sure to obtain the "Select All" item if it is selected and deselect it. These items are all obtained from the XamComboEditor's Items collection, and as of yet, I have been unable to see any types of errors occurring when clicking the Select All checkbox. Would it be possible for you to please provide some more detail on this error that you are seeing?
I have attached a sample project to demonstrate the above.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Thanks for the reply. This helped me a lot. But got a few extra things. For e.g as I mentioned earlier about the revisions of the documents. Now suppose there is an extra property in the SampleData say age. When I select the 'Select All' option I would like to select only those Persons with age above say 30.
if (((SampleData)e.AddedItems[0]).Label.Contains("Select All")){ foreach (var item in combo.Items) { if ((((SampleData)item).age) >= 30) //But getting an error item.IsSelected = true; else item.IsSelected = false; }}I get an error saying I cannot convert Combobox.item to SampleData.
Thank You
BS
Hi, Just to be more clear with my scenarioI have a Documents class, with document number, revision and last date modified properties. The data I have:DOC-001 Rev 0 19/12/2015DOC-001 Rev 1 19/01/2016DOC-001 Rev 2 19/02/2016DOC-002 Rev 0 19/01/2016DOC-002 Rev 1 19/02/2016DOC-003 Rev 0 19/02/2016
I need to implement the below functionalities in SelectionChanged event.1.The xamcomboeditor with multiple selections displays the list of documents. When I choose 'Select All', I have to select only those documents with the latest revisions ie, I have to select only DOC-001 Rev 2, DOC-002 Rev 1 and DOC-003 Rev 0.2.If the user selects DOC-001 Rev 0, I need to check if any other Revsions are checked and unselect the Rev 0 and inform the user that there is a revision already checked and that the user needs to unselect the other version and also reselect this.
I tried to convert the items to type Document to try and work it out, but it gives an error saying that Cannot convert type 'Infragistics.Controls.Editors.ComboEditorItem' to type Documents. Any ideas on this?
Thanks in advance,BS
This worked for me.
Thank You,
I have been investigating into this issue you are seeing, and the reason you are getting an exception is because the Items collection of the XamComboEditor is not a collection of your underlying data items - in your case, your Documents. Instead, it is a collection of the containers that represent your data items. These containers are of the type ComboEditorItem, and they each have a Data property that can be used to check your underlying "Documents" data item in this case. The error that you are seeing is very likely coming from an invalid cast that you may be trying to make, as ComboEditorItem will not be able to be casted to your "Documents" type.
As per your requirement, I would recommend that you continue with the SelectionChanged event and check the added and removed items of the event arguments to achieve your requirement. When an item is added, you can check the other selected items in your XamComboEditor to decide whether or not a new item should be selected or not, or whether you should select all of the latest revisions.
I have modified the original sample project I had sent you to model it after the requirements you are looking to achieve. This sample project is attached.