Projektdaten an XAML rendern

Überblick

XAML (Extensible Application Markup Language) ist eine deklarative XML-basierte Sprache, die hauptsächlich zum Definieren von Benutzeroberflächen in .NET-basierten Technologien wie WPF und UWP verwendet wird. Mit Aspose.Tasks für .NET können Entwickler Microsoft -Projektdaten (MPP, XML) in xaml -Format exportieren, die dann in Desktop -Anwendungen eingebettet werden können, gedruckt oder weiter angepasst mit WPF/XAML -Toolkits.

Diese Funktion ist nützlich, wenn:

Unterstützte Ausgangsansichten

Die Aufzählung von “PresentationFormat” definiert unterstützte Ansichtstypen beim Exportieren nach XAML:

Diese können mit Anzeigeoptionen kombiniert werden, um die Ausgabe vollständig anzupassen.

Rendering to XAML mit Speichernoptionen

So rendern Sie eine Projektdatei an XAML:

  1. Erstellen Sie eine Instanz von xamloptions;
  2. Konfigurieren Sie Layout-, Ansichts- und Anzeigeneinstellungen:
    • FitContent: ensures the content fits into view;
    • LegendOnEachPage: toggles legend visibility;
    • Timescale: sets granularity (e.g., Days, Weeks);
    • View: defines the layout and columns to include;
  3. Speichern Sie das Projekt mit project.save () mit SaveFileForformat.xaml.

Beispiel 1: Basic Save to XAML

1Project project = new Project("New Project.mpp");
2project.Save("RenderToXAML_out.xaml", SaveFileFormat.XAML);

Advanced Usage: Customizing View Options

Aspose.Tasks allows fine-grained customization of the XAML output. You can define:

Example 2: Export XAML with View Options

1Project project = new Project("New Project.mpp");
2SaveOptions options = new XamlOptions();
3options.FitContent = true;
4options.LegendOnEachPage = false;
5options.Timescale = Timescale.ThirdsOfMonths;
6project.Save("RenderXAMLWithOptions_out.xaml", options);

Rendering with Different Presentation Formats

You can choose different data perspectives when exporting to XAML using the PresentationFormat property.

Example 3: Export TaskUsage, ResourceUsage, and Gantt views

1Project project = new Project("New Project.mpp");
2SaveOptions options = new XamlOptions();
3options.PresentationFormat = PresentationFormat.GanttChart;
4project.Save("RenderDifferentPresentationFormatsToXAML_out.xaml", options);

Summary

Exporting project data to XAML using Aspose.Tasks for .NET opens up powerful integration capabilities with WPF/XAML-based desktop applications. The output is vector-based, resolution-independent, and ready to be styled and displayed dynamically.

🔗 See also:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.