Click here to Skip to main content
15,914,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save the state of the combo box control in my WPF application so that next time when i open the application i should see the last selected value of the combobox.
How to save the state?:confused:
Posted

 
Share this answer
 
Comments
seemakhaire 27-Dec-10 4:13am    
No this Post saves the column and width
And Actually i wanted to save the state of the combo box.
Means Whatever item is selected by last user he should be able to see that as a 1st item
Plz suggest me
Abhinav S 27-Dec-10 5:45am    
You can save any dependency property actually.
seemakhaire 28-Dec-10 2:51am    
Can You plz elaborate this more deeply
Tarun.K.S 28-Dec-10 3:24am    
Well dependency properties can't retain the combobox's state after closing your application.
You have to save the state in a registry.
Well in that case you can save the state of combobox by creating a registry on your computer for it. Save its registry value with that of its state and retrieve it when needed!

For example,I have used this technique for getting the last selected path so that next time the user can go straight to the folder path in the OpenDialog box.

Here are few links to create registries:

http://www.c-sharpcorner.com/uploadfile/sushmita_kumari/registrykeys102082006061720am/registrykeys1.aspx[^]

http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey%28v=vs.71%29.aspx[^]
 
Share this answer
 
v3

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