Select to view content in your preferred language

WindowPanel limit position

890
3
12-21-2010 11:18 PM
DmitryAleshkovsky
Deactivated User
When i drag my windowpanel over application window, i can drag winodow's header under the browser toolbar and under browser command line. After i release mouse button i can't get window back (look attachment).
How to limit windowpanel position inside application window?
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
The window panel is not designed for that, but you might find ideas about the controls to use on this thread:
http://forums.arcgis.com/threads/8403-Is-there-any-SL-control-that-acts-like-floating-panel
0 Kudos
DmitryAleshkovsky
Deactivated User
dbroux!
thank you for reply. I'll look for your link

The window panel is not designed for that[/URL]

It is interesting,what window panel is designed for? 🙂
0 Kudos
DmitryAleshkovsky
Deactivated User
Hope, now Window Panel is designed for that

for WindowPanel.xaml.cs
        private void headerDragRectangle_MouseMove(object sender, MouseEventArgs e)
        {
            if (isTrackingMouse)
            {
                Rectangle rect = sender as Rectangle;
                Point point = e.GetPosition(null);
                double aWidth = Application.Current.Host.Content.ActualWidth / Application.Current.Host.Content.ZoomFactor;
                double aHeight = Application.Current.Host.Content.ActualHeight / Application.Current.Host.Content.ZoomFactor;
                if (point.X < 0) point.X = 0;
                if (point.Y < 0) point.Y = 0;
                if (point.X > aWidth) point.X = aWidth;
                if (point.Y > aHeight) point.Y = aHeight;
                double x0 = this.renderTransform.X;
                double y0 = this.renderTransform.Y;
                double sign = 1;
                if (FlowDirection == System.Windows.FlowDirection.RightToLeft)
                    sign = -1;
                this.renderTransform.X = x0 + (point.X - mouseOffset.X) * sign;
                this.renderTransform.Y = y0 + point.Y - mouseOffset.Y;
                mouseOffset = point;
            }
        }
0 Kudos