Convert MS Project MPP to XAML Format using C#

Extensible Application Markup Language (XAML) is a simple and declarative language based on XML that uses the .xaml format for its files. In XAML, you can create, initialize, and set properties of objects with hierarchical relations. It is mainly used to design graphical user interfaces in Xamarin Forms, UWP (Universal Windows Platform), and WPF (Windows Presentation Foundation). In this article, you will learn how to convert Microsoft Project MPP files to XAML format using C#.

C# API for Converting MPP Files to XAML Format

Aspose.Tasks for .NET is an API for working with Microsoft Project (MPP) files. It allows you to read and write MPP/XML files without requiring Microsoft Project to be installed. Furthermore, the API enables you to convert MPP files to XAML format. You can either install the API through NuGet or download it directly from the Downloads section.

PM> Install-Package Aspose.Tasks

Convert MPP Files to XAML Format using C#

You can convert MPP files to XAML format in just a few lines of code. To achieve that, please follow the steps given below.

The following sample code shows how to convert MPP files to XAML format using C#.

Convert MPP Files to XAML Format with Additional Options

In order to customize the generated XAML file, you can use the XamlOptions class. To use the XamlOptions, follow the steps given below.

The following sample code shows how to convert an MPP file to XAML format using additional options with C#.

Set Presentation Format while Converting MPP Files to XAML Format

While converting MPP files to XAML format, you can use different presentation formats. To specify the presentation format, you will use the PresentationFormat enumeration. The PresentationFormat enumeration provides the following options.

  • PresentationFormat.GanttChart
  • PresentationFormat.TaskUsage
  • PresentationFormat.ResourceUsage
  • PresentationFormat.ResourceSheet
  • PresentationFormat.TaskSheet

The following are the steps to set the presentation format while converting MPP files to XAML format.

The following sample code shows how to set the presentation format while converting MPP files to XAML format using C#.

Get a Free License

In order to try the API without evaluation limitations, you can request a free temporary license.

Conclusion

In this article, you have learned how to convert MPP files to XAML format using C#. You have also learned how to customize the generated XAML output using additional options. Furthermore, you have seen how to set the presentation format for the generated XAML files using Aspose.Tasks for .NET API. The API provides many additional features for working with MPP files that you can explore in detail by visiting the official documentation. In case of any questions, please feel free to reach us at our free support forum.

See Also