プロジェクトデータをXAMLにレンダリングします

概要

XAML(拡張可能なアプリケーションマークアップ言語)は、主にWPFUWPなどの.NETベースのテクノロジーのユーザーインターフェイスを定義するために使用される宣言的なXMLベースの言語です。 .NETのAspose.Tasksを使用すると、開発者はMicrosoftプロジェクトデータ(MPP、XML)をXAML形式にエクスポートできます。これは、デスクトップアプリケーション、印刷、またはWPF/XAMLツールキットを使用してさらにカスタマイズできます。

この機能は、次の場合に役立ちます

サポートされている出力ビュー

PresentionFormat列挙は、XAMLにエクスポートするときにサポートされているビュータイプを定義します。

これらをディスプレイオプションと組み合わせて、出力を完全にカスタマイズすることができます。

保存オプションでXAMLにレンダリングします

プロジェクトファイルをXAMLにレンダリングするには:

  1. 「xamloptions」のインスタンスを作成します。
  2. レイアウト、表示、表示設定を構成します。
    • 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. project.save()を使用してプロジェクトを保存します savefileformat.xaml

例1: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.