动态更新 Silverlight 子元素的高度和宽度
我在我的 silverlight 应用程序中遇到了这个特殊的问题。我有一个带有一些路径元素的画布。我需要在这些 Path 元素之一之上加载另一个 UIElement。我有它的代码并且一切都已设置。
我面临的唯一问题是我无法更新这些路径元素的高度和宽度。
我想知道我是否可以做这样的事情,
(Path) this.canvas_name.Children[index].Height = height_of_a_UIElement;
(Path) this.canvas_name.Children[index].Width = width_of_a_UIElement;
似乎即使我投射它我也无法访问这些属性。
有人可以帮我吗?
谢谢!
I'm facing this peculiar problem in my silverlight app. I have a Canvas that has a few Path elements. I need to load another UIElement on top of one of these Path elements. I have the code for it and it is all set.
The only problem I am facing is that I cannot update the Height and Width of these Path elements.
I was wondering if I could do something like this,
(Path) this.canvas_name.Children[index].Height = height_of_a_UIElement;
(Path) this.canvas_name.Children[index].Width = width_of_a_UIElement;
It seems like even though I cast it I cannot access these properties.
Could anyone please help me?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在转换
Height
和Width
属性,而不是Path
对象。试试这个:You are casting the
Height
andWidth
properties, instead of thePath
objects. Try this: