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

How can I find real position of RadDiagramShape in the screen?

5 Answers 217 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Mahmut
Top achievements
Rank 1
Mahmut asked on 25 Mar 2015, 09:23 AM
Hi,
I try to find real position of shape. Position object in the shape doesn't provide it. I think you have a kind of position mechanism. I have a shape object, and I get diagram object by using the shape object.
I tried

DiagramExtensions.GetTransformedPoint(diagram,shape.Position);

,but it return same value.

And I tried this

var parent = ParentFinder.GetAncestor<RadDiagram>(shape);
var transformedPoint = shape.TransformToAncestor(parent)
              .Transform(new Point(0, 0));

but it return different value.
Actually I try to show popup which is positioned to shape object. I can try to position to Content, but then drag or selection operation handled by shape object.
How can I find real position of RadDiagramShape in the screen? or How can I show a popup according to position of the shape object.

Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 26 Mar 2015, 02:24 PM
Hi Mahmut,

You can take advantage of the ItemInformationAdorner.AdditionalContent property. It is of type object and you can visualize anything in it. Please note that this content is visualized when a shape is selected. An example of its usage is the SettingsPane extension control

The only concern about this property may be the fact that it is shared among all shapes. 

Regards,
Pavel R. Pavlov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Mahmut
Top achievements
Rank 1
answered on 27 Mar 2015, 07:56 AM
Hi Pavel,
Thanks for your answer. Like you said, InformationAdorner is shown, when item is selected. I want to show TextBlock for all items. TextBlock visibility and text changes according to some inputs. In addition, each item has different text property and format. If I put TextBlock in content of shape, then Connector margin will be changed( Connector must be placed with reference to my custom shape ). If I defined custom connectors, I must define for all format. So I must know How can I place a UIElement with reference to RadDiagramShape.
0
Pavel R. Pavlov
Telerik team
answered on 31 Mar 2015, 08:44 AM
Hello,

As far as I understand you need to show a separate TextBlock for all shapes. What I do not understand is why you want to host all those UI Elements outside the RadDiagram framework. This will require you to manually reposition all popups on every user interaction. This will most probably drop the overall performance of your application. This is why we highly recommend to you to reconsider your requirements and concrete implementation. There should be a better way to implement your scenario using our components only. There is no need you to manually position every one TextBlock that you need to host.

Please provide us with detailed information about your scenario and we will try to think of a better approach for you to implement. The more detailed the information is the more accurate the suggested approach will be. Everything regarding your scenario and requirements (e.g. pictures, mockups, videos, snippets...) may be of help.

Regards,
Pavel R. Pavlov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Mahmut
Top achievements
Rank 1
answered on 31 Mar 2015, 11:35 AM
Hi,
thanks for your response. Yes you are right, so I try to many things to handle this in RadDiagram Framework, but I couldn't. How can I solve this in the framework?. Actually I try to create a kind of InformationAdorner. There is only one difference, it will be active for all items, not only selected items.
0
Pavel R. Pavlov
Telerik team
answered on 01 Apr 2015, 11:16 AM
Hello,

Since you need to always show any information regarding each one of the shapes all the time, why don't you try hosting that information in the Content of the RadDiagramShape? I still cannot see any meaningful reason which forces you to visualize that particular information in separate UI Element outside our RadDiagram Framework. The best way to approach this issue is to host the information inside the shape itself.

Moreover, if you need to host that information outside our control this requirement goes beyond our support services since it does not concern any issues related to our controls. Finding the physical position of any UI Element rendered on your screen is a general programming question and we suggest looking for an answer in other community driven online resources (like StackOverflow).

Regards,
Pavel R. Pavlov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Diagram
Asked by
Mahmut
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Mahmut
Top achievements
Rank 1
Share this question
or