Click here to Skip to main content
13,057,050 members (43,766 online)
Click here to Skip to main content

Stats

43.6K views
2K downloads
21 bookmarked
Posted 3 Jun 2010

Resizing a Custom WPF Window

, 4 Jun 2010
Learn how to enable resizing of a custom WPF window created in Expression Blend
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 a software developer with a passion for WPF.

Awards,

  • CodeProject MVP 2013

  • CodeProject MVP 2012


You may also be interested in...

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