是否可以为 Silverlight 中的静态资源提供类型转换器?
我正在尝试设计一个 LineSeries
图表,该图表在其独立轴上具有 DateTime
对象,在其从属轴上具有整数值。我希望每当用户将鼠标悬停在 DataPoint
上时显示工具提示文本,显示其独立值和依赖值,但我需要格式化 DateTime
对象,以便显示我想要的格式。
我发现这个示例使用了属性ContentStringFormat
a ContentControl
,但经过一番挖掘后我了解到该属性在 Silverlight 中不可用,仅在 WPF 上可用。所以我找到了另一个使用转换器的示例,但我可以'不要将转换器定义放在 ResourseDictionary
上,就像放在 UserControl
上一样,因为 ResourceDictionary
没有属性 Resources< /code>.. :(
我不知道我的解释是否正确,但我的问题是.. 是否可以为 Silverlight 中的静态资源提供类型转换器?
编辑 - XAML
I'm trying to style a LineSeries
chart that has DateTime
objects on its independent axis and integer values in its dependent axis. I want to show a tooltip text whenever a user overs his mouse on a DataPoint
, showing both its independent and dependent values, but I need to format the DateTime
object in order to display the formatation I would like.
I found this example that uses the property ContentStringFormat
of a ContentControl
, but after some digging I learnt that that property is not available in Silverlight, only on WPF. So I found another example that uses a converter, but I can't place the converter definition on the ResourseDictionary
as I can on a UserControl
, because a ResourceDictionary
doesn't have the property Resources
.. :(
I don't know if I explained myself right, but my question is.. Is it possible to supply a type converter for a static resource in Silverlight?
EDIT - XAML
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个SO线程: 将字段的值传递给 Silverlight ConverterParameter
它有大量不同的方法来解决转换器的限制!
Take a look at this SO thread: Pass value of a field to Silverlight ConverterParameter
It has tons of different approaches for getting around converter limitations!