Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to add HUD button in Diagram (Read 4759 times)
Kumar Aditya
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 13th, 2013
How to add HUD button in Diagram
Jul 13th, 2013 at 12:17pm
Print Post  
I need to add a button, which can take any corner of the Diagram control and should not get affected by zoom in/out or scroll.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add HUD button in Diagram
Reply #1 - Jul 14th, 2013 at 9:34am
Print Post  
Add it to diagram's parent panel instead to the diagram:

Code
Select All
<Grid Name="grid">
    <ScrollViewer ...>
        <diag:Diagram ... />
    </ScrollViewer>

    <Button Content="HUD"
        HorizontalAlignment="Right"
        VerticalAlignment="Bottom"
        Margin="0,0,16,16"
        />
</Grid> 



The margins are necessary when aligning to bottom or right to avoid overlapping the scrollbars.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kumar Aditya
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 13th, 2013
Re: How to add HUD button in Diagram
Reply #2 - Jul 15th, 2013 at 12:14pm
Print Post  
Hi Stoyo,

Thanks for the quick response.
What i was looking for is "HUD" button should overlay on corner of the diagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add HUD button in Diagram
Reply #3 - Jul 15th, 2013 at 5:21pm
Print Post  
Hi,

The code above will place the button at the bottom right corner. Are you asking how to style the button with semi-transparency and other HUD-like effects?

Stoyan
  
Back to top
 
IP Logged
 
Kumar Aditya
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 13th, 2013
Re: How to add HUD button in Diagram
Reply #4 - Jul 16th, 2013 at 8:38am
Print Post  
Stoyo,

I have shared an image, in which I have drawn the outline of output as per your previous suggestion and what I am expecting to do. block mark as #1 is as per you code and, #2 is what I am looking for.

We need the HUD button inside the diagram control, kind of Pan button in Google maps, which remains at same location irrespective of zoom or panning.
  

HUD.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add HUD button in Diagram
Reply #5 - Jul 16th, 2013 at 10:40am
Print Post  
Hi,

You can ensure there's no blank space left in the scroll viewer (or other parent controls) like this:

Code
Select All
var r = diagram.Bounds;
r.Height = Math.Max(r.Height, scrollViewer.ActualHeight);
diagram.Bounds = r; 



You could also call that code from the ScrollViewer.SizeChanged handler to fill any added space if the scroll viewer can resize while the application runs.

If on the other hand you'd like to keep the empty space but move the button to the diagram's corner, set button's bottom margin to scrollViewer.ActualHeight - diagram.Bounds.Height.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kumar Aditya
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jul 13th, 2013
Re: How to add HUD button in Diagram
Reply #6 - Aug 1st, 2013 at 9:31am
Print Post  
Thanks Stoyo, solution provided did worked as expected.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint