Windows Phone,动感风格
我正在开发一个应用程序,我希望一些边框的颜色根据用户选择的主题而改变。边框部分放置在 xaml 中,但也会根据用户所做的选择在整个应用程序中动态生成。我还使用了一些 LoopingSelector 控件(来自 Silverlight 工具包),它们反过来也生成边框。
所以,我想知道我应该如何解决这个问题。最初,我尝试将样式应用于边框,然后根据主题的选择更改样式,但显然样式在运行时是只读的。我还认为我可以迭代并更改边框的颜色,但 LoopingSelector 似乎没有公开其边框的该属性,或者实际上根本没有公开控件。
所以我认为我应该以某种方式使用绑定,但由于我对 Silverlight 还很陌生,所以我不太确定如何去做。
提前致谢。
I'm working on an app where I want the color of a few borders to change depending on the users choice of theme. The borders are partly placed in the xaml, but also dynamically generated throughout the app depending on choices the user make. I am also using a few LoopingSelector controls (from the Silverlight toolkit), that in turn also generate borders.
So, I was wondering how I should approach this problem. Initially I tried applying a style to the borders, and then changing the style depending on the choice of theme, but apparently styles are read-only during run time. I also figured I could iterate through and change the color of the borders, but it seems the LoopingSelector doesn't expose that property of its borders, or really, expose the controls at all.
So I assume I should use binding in some way, but as I'm still quite new to Silverlight I'm not really sure how to go about that.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有一个命名资源(例如 CustomBorderBrush),您在 XAML 中将其用于 XAML 中的部分,那么您可以从应用程序的资源访问此画笔:
如果您还有问题使用
LoopingSelector
,那么这是一个单独的问题:) 听起来您需要将自己的样式应用于LoopingSelector
,以便您可以指定所需的画笔值。If you have a named resource, say CustomBorderBrush, that you are using in your XAML for the parts that are in the XAML, then you can access this brush from the Application's resources:
If you additionally have a problem with the
LoopingSelector
, then that's a separate issue :) It sounds like you need to apply your own style to theLoopingSelector
so that you can specify the brush value that you need.