使图像控件根据主题反转其颜色
我正在尝试弄清楚如何让 Windows Phone 应用程序中的 Image
控件根据用户在“设置”中选择的全局背景设置(“深色”或“浅色”)反转其颜色->主题->背景。
I'm trying to work out how to have an Image
control in my Windows Phone application invert its colors based on the global background setting (either "Dark" or "Light") chosen by the user in Settings->Themes->Background.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
框架内没有内置的方法来反转图像颜色。
相反,由于在手机上执行此操作的开销,您应该在设计/构建时创建图像的两个版本,然后通过检测 主题可见性和不透明度。
There is no built-in way to invert image colors within the framework.
Instead, because of the overhead of doing this on the phone, you should create both versions of the image at design/build time and then choose which version to display from your code by detecting Theme Visibility and Opacity.
我必须补充一点,我最终所做的是马特所写内容的延续。
代码如下所示:
I must add that what i did in the end was a continuation of what Matt wrote.
the code looks like this:
这个问题已经有1.5年历史了。但是这里是做你想做的事情的最简单的方法。那里给出的例子非常简单,比如
This Question is 1.5 years old now. But here is the easiest way to do what you want. The example given there is very simple like