Is it ok to use a class like this (design / guideline specific)? I\'m using MVVM Pattern.
public static class Pages
{
public const string Home = \"Home.xaml\
I think this is one of the best things you can do.
Some more suggestions: with strings it's perfectly fine to use const
s. In case you'd want to use different types, use static readonly
and then initialize in a static
constructor.
For a different approach using enums, see this thread. Since what you're trying to do looks a lot like a string enum, that might be the way to go for you.
And don't forget that as long as you specify your pages in code, making changes (e.g. renaming or moving a page) will be a pain. Consider using something like resources or sitemaps. (In case you only use the class for a page list, I'd go with using C#'s strongly typed resources - they will behave in the same way as your class and you won't have to code them by hand.)