存储和显示 xaml 图标的标准方式是什么?

发布于 2025-01-06 19:27:13 字数 513 浏览 2 评论 0原文

我已经开始在我的 WPF 应用程序中使用基于 xaml 的图标,但正在努力寻找一种简单的方法来存储和共享它们。图标是 DrawingBrushes。

我是吗?

A) 将每个图标存储在其自己的 xaml 文件中,并封装在资源字典中。这意味着我要么每次想要绘制一个图标资源时都必须提取每个图标资源,要么创建一个标准的“图标”字典来提取每个 xaml 文件。这看起来维护起来很痛苦,而且每次我想使用图标时我仍然必须拉入图标资源字典。

如果我确实这么做了,人们通常如何显示该图标?只是一个以画笔为背景的画布?

B) 将每个图标作为 UserControl 存储在其自己的 xaml 文件中。这使得显示图标变得非常简单 - 只需插入适当的控件即可,而且在 XAML 顶部声明 XML 图标命名空间比合并资源字典更简单。

C) 将所有图标存储在一个包含在资源字典中的 XAML 文件中。要合并的一本字典,但无需维护将各个文件拉入该字典。但编辑图标可能会很尴尬。

D)....?

其他人如何管理他们的图标?

I have started using xaml based icons in my WPF app, but am struggling to find a simple way to store and share them. The icons are DrawingBrushes.

Do I?

A) Store each icon in its own xaml file wrapped in a resource dictionary. This means that I either have to pull in each icon resource every time I want to paint one, or create a standard "icons" dictionary that pulls every xaml file. This seems a pain to have to maintain, and I still have to pull in the icons resource dictionary every time I want to use an icon.

If I did go for this, how do people normally display the icon? Just a Canvas with the brush as the background?

B) Store each icon in its own xaml file as a UserControl. This makes displaying an icon dead easy - just plonk the approprate control in, and its arguably simpler to declare the XML icons namespace at the top of your XAML rather than merging a resource dictionary.

C) Store all icons in one XAML file wrapped in a resource dictionary. One dictionary to merge but without the maintenance of pulling in individual files into that dictionary. Potentially awkward to edit icons though.

D) ....?

How are other people managing their icons?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文