Is there a way to make Tab and Enter both commit the currently selected value?
Thanks,
Jon
Hi Jon,
Maybe it's because we are using different versions of the Infragistics DLLs but when I tested this against the latest 14.2 WPF DLLs I was not able to reproduce this. In my sample if I start typing values into the combo editor text box, it filters the dropdown values as expected. If I then press the Tab key to move focus away from the combo editor and into a different control, I can see that the first value in the filtered dropdown is selected. Both the SelectedItem and SelectedValue (assuming I set SelectedValuePath) properties have updated. I have attached my sample. Are my steps wrong? Or are you using an older version? If so can you tell me what the exact version # is of the DLLs you are using?
Sorry I didn't give more information. I am on 14.2.
The issue is only if I have CustomValueEnteredAction="Allow". I would like tab in some cases to commit the selected record.
Thanks.
When you set the SelectedIndex, the index provided should be the index for the item you want selected in the current list of dropdown items. If you look at the sample in my previous update you can see that there are 3 items in the drop down when no value is typed into the textbox, Joe, Mary and Jim. If I type in "M" then I see that Mary is the only option that appears in the dropdown. Pressing Tab then selects Mary even though I set the SelectedIndex to 0. If it didn't select from only the available items in the dropdown then Joe should have been selected as he appears before Mary in the ItemsSource.
My requirements have changed a little bit. I now have CustomValueEnteredAction="Add".
I need to commit any value typed in as well. How do I allow the typed value to be added on events other than Enter. I need it to work on tab (not just selected item, but newly typed value) and also upon lose focus.
I am in a XamDataGrid, so I have tried DataPresenterCommands.EndEditModeAndCommitRecord both in editmodeending and also in XamMultiColumnComboEditor DropDownClosing, but it appears that the value has already been cleared.
Any ideas?
Sorry to push on this, but I have a tight deadline on this issue.
I set the CustomValueEnteredAction to "Add" but when I type in a value that doesn't exist in the data and press the tab key, that value not only gets added but it is also selected. So this appears to already support your requirement. You should be able to see this in my sample. You will have to comment out the PreviewKeyDown stuff in order to run it with CustomValueEnteredAction="Add" but you will see that typing in a value and pressing the tab key causes the value to be added and selected.
If you do not see this behavior then please let me know what the exact version # is for the Infragistics DLLs that you are using so I can test that version. It will look like this: 14.2.20142.****.
My DLLs are 14.2.20142.1000.
Here is a link to my files:
http://1drv.ms/1xCAxkk
I have attached a screen video of what I'm trying to do with a sample project.
In the Attribute 1 column, I type in 1.5 and click Enter. Value is committed as expected.
In the Attribute 2 column, I type in 1.5 and click Tab. Value is lost.
In the Attribute 3 column, I type in 1.5 and click outside the cell. Value is lost.
These are the scenarios I need to have the value committed.
Also, as you can see from the video, there is a secondary issue with the popup. As I'm typing sometimes the footer does not render properly. You see the blue line that shows up. All I'm doing is showing the footer only when all items have been filtered out.
Let me know if you have any more questions for me. Thank you so much for your time.
Is that the right link? When I go to it, it opens an excel file called starting_new_budget_template_new.
Here is the correct link.
http://1drv.ms/1OD456A
Thanks. I can see the behavior you described in the sample. I'm looking into this.
The editor's value was not getting set for some reason so I modified the code to handle the combo editor's SelectionChanged event. This event is firing when you press Enter/Tab or click away from the editor when there is text in the combo editor (since the "Add" modifier is on). Once a selection is made I am getting the cell and setting it's Value directly. One thing I'm confused about is the way that you are setting the DropDownValues collection. The code is currently setting this every time edit mode is started on the cell so I would think that any additions you add to the dropdown list would be lost when you entered edit mode on that cell again. Wouldn't you want to persist the collection rather than resetting it constantly?
Thanks for getting back to me.
I haven't looked at your sample yet, but to answer your question:
DropDownValues is created based on what the values are in other columns, so it needs to be recreated whenever a value changes anywhere in the row. So I suppose I could persist it and try to be smarter about when the other values are dirty, but even then I would need one for each cell, so having those always ready would increase my program's memory footprint. I am just adding them to the collection so it is a valid selection that gets sent back to the textbox mode when the cell is not in edit mode, so if you have a better solution for that I am all ears.