制作可重复使用的控件 - 从设计师的角度来看最佳实践? [英] Making re-usable controls -- best practices from a designer point of view?

查看:80
本文介绍了制作可重复使用的控件 - 从设计师的角度来看最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一个开发团队合作,该团队正在使用我们的WPF应用程序并将其某些部分移植到其他公司的可重用控件中。我一直在WPF应用程序的设计方面创建这些控件的外观和感觉,并将它们混合到最终UI中以提供用户体验。既然我们正在使用部分应用程序并从中创建控件,我想知道从设计的角度为其他开发人员提供灵活性的"最佳实践"。

任何见解我将不胜感激,因为这对我来说是一个新领域。


Purkiss

I'm working with a development team that is taking our WPF application and porting certain parts of it into reusable controls for other companies.  I've been on the design side of the WPF application creating the look and feel for these controls and blending them into the final UI to provide the user experience.  Now that we are taking portions of the application and creating controls out of them, I'd like to know the 'best practices' for providing flexibility to other developers from a design point of view.

Any insight would be appreciated, as this is new territory for me.


Purkiss

推荐答案

你们需要使用无视控件: http://www.devx.com/dotnet/Article/34564

简而言之,它们允许在多个版本上重用相同的代码。例如,您可以从一个控件到构建3个单独的控件来驱动水平日期/时间选择器,垂直日期/时间选择器和折叠/扩展日期/时间选择器。直到最近(我们还不知道更好),我们犯了错误,不使用它们与我们当前的项目,差别很大。
除此之外,我建议保留一个单独的资源画笔和颜色的字典。将它们命名为有意义的东西(例如PageBackground,LinkedText等)而不是像鲜红色这样的描述符。当有时间重新打开时,您可以轻松复制文件并快速更改所有值,而不是打开每个控件并切换画笔/颜色值。
You guys need to be using lookless controls: http://www.devx.com/dotnet/Article/34564

In a nutshell, they allow the same code behind to be reused on multiple versions. For example, you can drive a horizontal date/time picker, a vertical date/time picker, and a collapsing/expanding date/time picker all from one control vs building 3 seperate ones. We made the mistake of not using them with our current project until just recently (we didn't know any better), and the difference is huge.

Other than that, I would reccomend keeping a seperate resource dictionary for brushes and colors. Name them things that make sense (e.g. PageBackground, LinkedText, etc) instead of descriptors like bright red. When it somes time to reskin, you can easily duplicate the file and quickly change all of the values instead of opening up every control and switching the brush/color values.


这篇关于制作可重复使用的控件 - 从设计师的角度来看最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆