locked
Expression Blend form RRS feed

  • Question

  •  
    Hi!
    I'm new here and new to Expression Blend.
    I have a WPF form in Expression blend that has no border.
    Since WPF code isn't like regular C# code- I can't figure out how to able
    the user moving the form.
    This doesn't work in WPF- only in a regular C# application:
    Code:
    Point mouse;  
    private void form1_MouseDown(object sender, MouseEventArgs e)  
            {  
                if (e.Button==MouseButtons.Left)  
                {  
                    mouse = e.Location;  
                }  
     
            }  
     
            private void form1_MouseMove(object sender, MouseEventArgs e)  
            {  
     
                if (e.Button == MouseButtons.Left)  
            
                    thisthis.Left = this.Location.X + e.Location.X - mouse.X;  
                    thisthis.Top = this.Location.Y + e.Location.Y - mouse.Y;   
                }  
     
            } 
    Can someone please help me figuring out how to move the borderless WPF form by code?

    Thanks!
    • Edited by amitairos Thursday, July 31, 2008 9:05 AM Spelling
    Thursday, July 31, 2008 9:03 AM

All replies

  • Please reply.
    Thursday, July 31, 2008 8:55 PM
  • Please please reply.
    • Edited by amitairos Sunday, August 3, 2008 9:56 AM Spelling
    Sunday, August 3, 2008 9:56 AM
  • I created a small WPF app with no border but still uses an image file for the shape of the window. To make it drag, select your object and go to the Properties panel. Click on the Event button. (Looks like a little lightning bolt at the top right) and scroll down to MouseDown. Double Click that empty field and it will open up the code in Visual Studio. Since you are using C#, it will create an event handler. Put in the code "this.DragMove();" and it Should allow your app to be dragged around.
    -Mark Weller
    Tuesday, August 5, 2008 12:04 AM