Set the Rectangle MaxHeight: 25 50 75 100 125 150 175 200
//File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Media Imports System.Windows.Controls Imports System.Windows.Documents Namespace Height_MinHeight_MaxHeight Public Partial Class Window1 Inherits Window Public Sub changeMaxHeight(sender As Object, args As SelectionChangedEventArgs) Dim li As ListBoxItem = TryCast(TryCast(sender, ListBox).SelectedItem, ListBoxItem) Dim sz1 As [Double] = [Double].Parse(li.Content.ToString()) rect1.MaxHeight = sz1 rect1.UpdateLayout() Console.WriteLine("ActualHeight is set to " + rect1.ActualHeight) Console.WriteLine("Height is set to " + rect1.Height) Console.WriteLine("MinHeight is set to " + rect1.MinHeight) Console.WriteLine("MaxHeight is set to " + rect1.MaxHeight) End Sub Public Sub clipRect(sender As Object, args As RoutedEventArgs) myCanvas.ClipToBounds = True Console.WriteLine("Canvas.ClipToBounds is set to " + myCanvas.ClipToBounds) End Sub Public Sub unclipRect(sender As Object, args As RoutedEventArgs) myCanvas.ClipToBounds = False Console.WriteLine("Canvas.ClipToBounds is set to " + myCanvas.ClipToBounds) End Sub End Class End Namespace