x:Silverlight 中的共享标记扩展
silverlight 中缺少 x:Shared MarkupExtension 是否有解决方法?
我有以下 Xaml,它在每个目标系列上创建一个椭圆。我需要椭圆是唯一的,因为它们稍后会添加到画布中。通过使用此 Xaml,我收到以下错误:UIElement 已添加到另一个父级(例如,单个 Ellipse 实例多次添加到 Canvas)。
在 WPF 中,我只需使用此样式的 x:Shared 属性即可使其正常工作。
<!-- Set the style for the series -->
<Style TargetType="SciChart:FastLineRenderableSeries" >
<Setter Property="SeriesColor" Value="#FF93F2C1"/>
<Setter Property="ResamplingMode" Value="Mid"/>
<Setter Property="RolloverMarker">
<Setter.Value>
<Ellipse Width="9" Height="9" Fill="#7793F2C1" Stroke="#FFA3FFC9"/>
</Setter.Value>
</Setter>
</Style>
我考虑的解决方法是创建一个名为 RolloverMarker 的控件并设置其控件模板。我将不胜感激任何直接或间接解决此问题的方法。
Is there a workaround for the missing x:Shared MarkupExtension in silverlight?
I have the following Xaml which is creating an ellipse on each target series. I need the ellipses to be unique as they are later added to canvas. By using this Xaml I get the error that the UIElement has already been added to another parent (e.g. single Ellipse instance added to Canvas multiple times).
In WPF I simply use the x:Shared property on this style to get it to work.
<!-- Set the style for the series -->
<Style TargetType="SciChart:FastLineRenderableSeries" >
<Setter Property="SeriesColor" Value="#FF93F2C1"/>
<Setter Property="ResamplingMode" Value="Mid"/>
<Setter Property="RolloverMarker">
<Setter.Value>
<Ellipse Width="9" Height="9" Fill="#7793F2C1" Stroke="#FFA3FFC9"/>
</Setter.Value>
</Setter>
</Style>
A workaround I considered was to create a control called RolloverMarker and set its control template. I'd appreciate any direct or indirect solutions to this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您动态地将对象添加到面板,则每次都需要创建一个新对象,或者您需要在某种模板中定义控件并添加将使用该模板的新数据对象。您不能多次添加同一项目。
例如,
或者
If you are dynamically adding objects to a panel, then a new object needs to be created each time, or you need to define your control in some kind of Template and add a new data object which will use the Template. You cannot add the same item multiple times.
For example,
Or