是否可以像部分类一样拥有部分xaml

是否可以像部分类一样拥有部分xaml

本文介绍了是否可以像部分类一样拥有部分xaml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个 xaml 文件拆分成几个文件,有点像部分类:有没有办法做到这一点?

I'd like to split a xaml file into several files a bit like partial class : is there a way to do so ?

我希望能够更方便地管理我的项目文件.

I want to be able to manage my project files more convenienly.

推荐答案

有一些可能性,尽管它可能不是您所想的那样.

There are some possibilites, although it may not be exactly what you think about.

您可以通过 ResourceDictionary 外包资源.这对于样式和模板非常方便.当然,您必须组织您的 XAML,以便您可以从中受益(例如使用 ControlTemplates).

You may outsource ressources by means of a ResourceDictionary. This is very convenient for styles and templates. Of course you have to organize your XAML such that you could benefit of it (use ControlTemplates for instance).

此外,您可以创建封装部分 XAML 的 UserControl.不过,这取决于您的布局.

Furthermore you could create UserControls that encapsulate parts of your XAML. This depends on your layout, though.

这些部件可以组织成程序集,您可以通过 xmlns 以 XAML 已知的引用来引用这些程序集:???声明.

These parts can be organized in assemblies, which you refer to by references known to XAML via xmlns:??? declarations.

这篇关于是否可以像部分类一样拥有部分xaml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:14