How to know ActualHeight from shape?

5 posts, 0 answers
  1. Mikel
    Mikel avatar
    21 posts
    Member since:
    Feb 2014

    Posted 27 Jul 2015 Link to this post

    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!

     

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Jul 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Mikel
    Mikel avatar
    21 posts
    Member since:
    Feb 2014

    Posted 28 Jul 2015 in reply to Petar Mladenov Link to this post

    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!

     

     

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Jul 2015 Link to this post

    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
  6. Mikel
    Mikel avatar
    21 posts
    Member since:
    Feb 2014

    Posted 31 Jul 2015 in reply to Petar Mladenov Link to this post

    That was the problem.

     

    Thank you Petar!

Back to Top
UI for WPF is Visual Studio 2017 Ready