Looking for guidelines to create application file. For example I have an application that store user input into a file (Textbox, DataGrid, ListBox etc). I’m looking for WPF-C# implementation.
I would like to have the following:
- If user edit a any form(Textbox, etc) an asterisk is displayed to the window title.
- When window is closed and asterisk is still there, a promote “Would you like to save changes” appears. If then saved the asterisk disappear.
What do real applications use to create their application file? (Note: I’m not looking for database saving or SQL)
I’m just looking for hints and guidelines. Thank you.
Use the IsDirty pattern, which is where you have a boolean property for each field that you flip to true on TextChanged events. This can be used to determine when to show the asterix. After they click save you clear the IsDirty properties for each field.
Bind your form to a class object that represents the data you want to save, and serialize that object to a file on save.