Skip to content

Additional guidance - Resources files organization #2

@cmaneu

Description

@cmaneu

It can be great to give additional guidance about XAML code structure/organization.
This is a draft of such a guidance.

Resources dictionary organisation

Depending on the app size, target platform and usage styles, you may want to choose a specific ResourceDictionary files structure. You can then tweak loading and parsing times for your specific constrains.

If you're working on a project where you don't have a large amount of XAML resource code, you can use the following files structure:

  • AppTheme.Constants.xaml: This resource dictionary contains resources like margins, component sizes, etc...
  • AppTheme.FontsAndColors.xaml: This resource dictonary contains Font families, font sizes and strings glyh codes for symbol fonts. Because this XAML file can be quite short, we also add all colors and burshes for our app in that same file,
  • AppTheme.Styles.xaml: This file contains only the styles for the app. This XAML file uses resources defined in the AppTheme.Constants.xaml and AppTheme.FontsAndColors.xaml.
  • AppTheme.DataTemplates.xaml: The general rule for the datatemplates is to declare them within the XAML file where is used. However, if you are using a datatemplate in different XAML pages, you can group them into this ResourceDictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions