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!
You are casting the Height
and Width
properties, instead of the Path
objects. Try this:
((Path) this.canvas_name.Children[index]).Height = height_of_a_UIElement;
((Path) this.canvas_name.Children[index]).Width = width_of_a_UIElement;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.