This is a migrated thread and some comments may be shown as answers.

How to know ActualHeight from shape?

4 Answers 218 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Mikel
Top achievements
Rank 1
Mikel asked on 27 Jul 2015, 10:38 AM

Hello,

I want to align some custom shapes vertically from my diagram.  I make a method called AlignShapes inside a class inheried from SerializableGraphSourceBase<Shape_VM, Link_VM>, and this method is invoked always when InternalItems Changed.

I have create my custom shape class, inherited from NodeViewModelBase and I give it 2 properties, Height and Width (double), that I binded these properties in XAML. Depend of the custom shape, height value is NaN for auto-size, then, when I get the value from custom shape, it return NaN, but the shape in the diagram has a specific height value that I do not know to get.

 How can I get Shape ActualHeight?

 

Thank you!

 

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Jul 2015, 08:19 AM
Hello Mikel,

To get a Shapes' actual size runtime you can use Bounds, ActualHeight and ActualWidth properties. Let us know if this helps you move forward.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mikel
Top achievements
Rank 1
answered on 28 Jul 2015, 10:00 AM

Hi Petar!

 

I make AlignShape() in View class, that class has access to RadDiagramShape, and RadDiagramShape has access to ActualHeight, and the value of that property is 0.  :( I dont know why happen that.

I take a picture in debug mode of object value. How can I get real height of the shape?

 

Thank you, Regards!

 

 

0
Petar Mladenov
Telerik team
answered on 29 Jul 2015, 07:03 AM
Hi Mikel,

I guess you invoke this method too early and the shapes are not rendered yet. Is this the case ? When do you call the method ? You can try calling it in Dispatcher.BeginInvoke(()=> call).

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mikel
Top achievements
Rank 1
answered on 31 Jul 2015, 07:33 AM

That was the problem.

 

Thank you Petar!

Tags
Diagram
Asked by
Mikel
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Mikel
Top achievements
Rank 1
Share this question
or