I'm quite new to programming. I'm making an UWP application, and on one of the pages I want to display a bunch of laws and regulations.
Where should I store the text/paragraphs? I do not want to write them all in the XAML file, as this will take a lot of space and make the XAML file hard to navigate and read.
I know it's possible to store text-strings in a resource file (.resw), but for me it seems like this is made for storing strings in different languages.
Should I store the strings in a database, SQL? I have not worked with databases before but I'm eager to learn it if that's the way to go.
I have added a picture of what the law-paragraphs looks like (the text is in norwegian). The paragraphs will be displayed in different frames on the page. It would be nice if I could easily add and edit text in the database.
CodePudding user response:
Best way to store text in UWP application
You have many ways to store the text, you could create txt file in your local folder and write the text in it, and here is document how to read and write data into file.
I checked your law-paragraphs, it's not very long string, so you could use LocalSettings
to store this law-paragraphs with specific key quickly. Each setting can be up to 8K bytes in size and each composite setting can be up to 64K bytes in size. For more info please refer this document.
And we don't suggest your store this simple law-paragraphs string with SQL, it's too heavy, if you do want it, please refer Use a SQLite database in a UWP app