简体   繁体   English

Universal App便携式库中的颜色?

[英]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.

相关问题 如何将Windows Universal App迁移到Portable Library Project? - How to migrate a Windows Universal App to Portable Library Project? Windows XAML通用便携式库中的Windows Phone API在哪里? - Where are the Windows Phone APIs in Windows XAML Universal Portable Library? 类库(可用于Universal Apps移植)System.Threading.Thread的限制 - Class Library (Portable for Universal Apps) System.Threading.Thread limitations 从通用共享应用访问类库 - Access Class Library from Universal Shared App Windows Universal / Store App中的类库本地化 - Class Library Localization in Windows Universal / Store App Netcore库与通用Windows应用程序及其他应用程序的兼容性 - Netcore library compatibility with universal windows app and others Windows Universal App的Active Directory身份验证库 - Active Directory Authentication Library with Windows Universal App 在通用Windows应用程序中显示便携式灰度图(PGM)图像(c#,XAML) - Displaying Portable Graymap (PGM) images in Universal Windows App (c#, XAML) 如何加载和绑定UWP应用程序中的可移植库中包含的图像? - How to load and bind a image contained in a portable library within an UWP app? Xamarin应用程序null从可移植类库中返回 - Xamarin app null being returned from portable class library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM