[英]Colors in a Universal App portable library?
My portable library defines several objects which have colors associated with them. 我的可移植库定义了一些具有颜色关联的对象。 These colors are used in the UI layers of whichever apps use the library. 无论使用哪个库的应用程序的UI层都使用这些颜色。 Given that all the UI-layer stuff operates with Windows.UI.Color, I'd like to store objects of that type in my portable library. 鉴于所有UI层的东西都可以使用Windows.UI.Color进行操作,因此我想将该类型的对象存储在我的可移植库中。 Problem is that I can't find any way to reference this Color class in the library code. 问题是我找不到在库代码中引用此Color类的任何方法。
At the moment, I'm stuck maintaining colors as strings of hex ("#FF00AA"), but this means I'm parsing a string every time I want to reference the color. 此刻,我坚持将颜色保持为十六进制字符串(“#FF00AA”),但这意味着我每次要引用颜色时都在解析字符串。 Sure, I could optimize it further (caching the constructed Color object, splitting the string preemptively), but this seems silly. 当然,我可以进一步优化它(缓存构造的Color对象,先占先后拆分字符串),但这似乎很愚蠢。
How can I get the Windows.UI.Color class in a Universal portable library? 如何在通用可移植库中获取Windows.UI.Color类?
What targets You have set in this portable library? 您在此便携式库中设置了哪些目标? Or is it "Shared" library for universal apps? 还是通用应用程序的“共享”库?
In the second case, its no problem use Windows.UI.Color class. 在第二种情况下,使用Windows.UI.Color类没有问题。 If its another portable library, set targets to Windows 8.1 and Windows Phone 8.1. 如果它是另一个可移植的库,请将目标设置为Windows 8.1和Windows Phone 8.1。 I used Color class in that library and I had no problems. 我在该库中使用了Color类,但没有任何问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.