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

OnLocationChanged event isn't fired when ToolWindow is floating

1 Answer 111 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Gerben
Top achievements
Rank 1
Gerben asked on 10 Sep 2010, 01:29 PM
For a project, i need to resize ToolWindows when they are floating, and are at a certain position at the screen, but the onlocationChange event isn't fired when I move the floating window on the screen

It is fired  before i make the window floating.

I'm using the 2010 Q2 SP1 release.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Sep 2010, 09:18 AM
Hi Gerben,

Thank you for the question.

When you float a ToolWindow, you should subscribe to the LocationChanged property of the ToolWindow's FloatingParent. Let's assume that we have a docked ToolWindow that the user floats at runtime. The code that will allow you to track the location changes of the floating form is:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
  
        this.radDock1.DockStateChanged += new Telerik.WinControls.UI.Docking.DockWindowEventHandler(radDock1_DockStateChanged);
    }
  
    FloatingWindow floatingW;
  
    void radDock1_DockStateChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
    {
        if (e.DockWindow.DockState == Telerik.WinControls.UI.Docking.DockState.Floating)
        {
            floatingW = e.DockWindow.FloatingParent;
            floatingW.LocationChanged += new EventHandler(floating_LocationChanged);
        }
    }
  
    void floating_LocationChanged(object sender, EventArgs e)
    {
        Console.WriteLine(floatingW.Location);
    }
}

I hope this helps.
 
Sincerely yours,
Stefan
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Dock
Asked by
Gerben
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or