Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Resizing a Custom WPF Window

, 4 Jun 2010 CPOL
Learn how to enable resizing of a custom WPF window created in Expression Blend
Custom_Win_Resize_Demo.zip
Custom Win Resize_Demo
Custom Win Resize
Application.ico
bin
Debug
My Project
Custom Win Resize.suo
Class MainWindow


	Private Sub Top_DragDelta(ByVal sender as Object, ByVal e as System.Windows.Controls.Primitives.DragDeltaEventArgs)
		'TODO: Add event handler implementation here.
		If Me.Height > Me.MinHeight Then
			Me.Height -= e.VerticalChange
			Me.Top += e.VerticalChange
		Else
			Me.Height = Me.MinHeight + 4
			TopThumb.ReleaseMouseCapture()
		End If
	End Sub

	Private Sub Btm_DragDelta(ByVal sender as Object, ByVal e as System.Windows.Controls.Primitives.DragDeltaEventArgs)
		'TODO: Add event handler implementation here.
		If Me.Height > Me.MinHeight Then
			Me.Height += e.VerticalChange
		Else
			Me.Height = Me.MinHeight + 4
			BtmThumb.ReleaseMouseCapture()
		End If
	End Sub

	Private Sub Rgt_DragDelta(ByVal sender as Object, ByVal e as System.Windows.Controls.Primitives.DragDeltaEventArgs)
		'TODO: Add event handler implementation here.
		If Me.Width > Me.MinWidth Then
			Me.Width += e.HorizontalChange
		Else
			Me.Width = Me.MinWidth + 4
			RgtThumb.ReleaseMouseCapture()
		End If
	End Sub

	Private Sub Lft_DragDelta(ByVal sender as Object, ByVal e as System.Windows.Controls.Primitives.DragDeltaEventArgs)
		'TODO: Add event handler implementation here.
		If Me.Width > Me.MinWidth Then
			Me.Width -= e.HorizontalChange
			Me.Left += e.HorizontalChange
		Else
			Me.Width = Me.MinWidth + 4
			LftThumb.ReleaseMouseCapture()
		End If
	End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Meshack Musundi
Software Developer
Kenya Kenya
Meshack is an avid programmer with a bias towards WPF and VB.NET. He has about 5 years of programming experience initially starting off with Java before shifting to .NET, thanks to the allure of WPF. He has developed several applications, and written several articles about them, which can be viewed here on CodeProject. He currently resides in a small town in Kiambu county, Kenya.
 
Awards;
  • CodeProject MVP 2013
  • CodeProject MVP 2012
  • Best VB.NET article of August 2013
  • Best VB.NET article of February 2013
  • Best VB.NET article of October 2012
  • Best VB.NET article of July 2012
  • Best VB.NET article of February 2012
  • Best VB.NET article of January 2012
  • Best VB.NET article of November 2011
  • Best VB.NET article of June 2011
  • Best VB.NET article of May 2011
  • Best VB.NET article of March 2011
  • Best VB.NET article of February 2011
  • Best VB.NET article of January 2011
  • Best VB.NET article of December 2010
  • Best VB.NET article of November 2010

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141220.1 | Last Updated 4 Jun 2010
Article Copyright 2010 by Meshack Musundi
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid