Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following problem: On all the forms where you must select a UnitOfMeasurement it displays the first UOMinfo from the UOMTable in the field, when changed it save the correct information to the relevant table. When you move to the next record and back it still display the first UOMitem from the UOMTable on the form, but the table info is correct. Combobox grid.column="2" itemssource="{Binding Source={StaticResource UOMsSource}}" selectedvalue="{Binding Path=UnitOfMeasurement}"/

In xaml.cs :
var UOM1 = from item in BusinessLayer.BusinessLayer.db.UnitOfMeasurements
                       orderby item.UnitOfMeasurementCode
                       select item;
((CollectionViewSource)Resources["UOMsSource"]).Source = UOM1;


Suzette
Posted
Updated 21-Apr-10 11:25am
v4

I'm not quite sure I understand where the question is. Let me see if I understand the component parts.

- You have a unit of measurement lookup, the contents of which are populates into a combobox on your form.
- When you've saved a record, after selecting a UOM, when the information is saved and you revist the record, the lookup still shows the first entry in the list?

If that's correct, then what you need to do is when you load the list item and you have a loaded record, set the SelectedItem of the combobox = the loaded UOM from your record. If you save the id of the UOM (which I imagine you do) then you will need to either load the UOM for that id and then set your selected item, or loop through your combobox and set the selecteditem = the item with the id of the current record.
 
Share this answer
 
hammerstein05 thanks for the answer. But please forgive me for being stupid. I have been working 18 hour days for the last 2 months and just can not think clearly anymore. I understand what you say I must do but for the life of me do not know how to do it. Will you please explain exactly what I must do?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900