Set the Rectangle MinHeight: 25 50 75 100 125 150 175 200
//File:Window.xaml.cs using System; using System.Windows; using System.Windows.Media; using System.Windows.Controls; using System.Windows.Documents; namespace Height_MinHeight_MaxHeight { public partial class Window1 : Window { public void changeMinHeight(object sender, SelectionChangedEventArgs args) { ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem); Double sz1 = Double.Parse(li.Content.ToString()); rect1.MinHeight = 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); } public void clipRect(object sender, RoutedEventArgs args) { myCanvas.ClipToBounds = true; Console.WriteLine("Canvas.ClipToBounds is set to " + myCanvas.ClipToBounds); } public void unclipRect(object sender, RoutedEventArgs args) { myCanvas.ClipToBounds = false; Console.WriteLine("Canvas.ClipToBounds is set to " + myCanvas.ClipToBounds); } } }