Canvas.SetBottom
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Canvas_Positioning_Properties.Window1"
Title="Canvas Positioning Properties">
<StackPanel>
<Canvas Name="canvas1" Height="300">
<TextBlock Name="text1" FontWeight="Bold" Canvas.Left="0" Canvas.Right="0" Canvas.Top="0" Canvas.Bottom="0">A TextBlock.</TextBlock>
</Canvas>
<ListBox Grid.Column="7" Grid.Row="1" VerticalAlignment="Top" Width="60" Margin="10,0,0,0" SelectionChanged="ChangeBottom">
<ListBoxItem>Auto</ListBoxItem>
<ListBoxItem>10</ListBoxItem>
<ListBoxItem>20</ListBoxItem>
<ListBoxItem>30</ListBoxItem>
<ListBoxItem>40</ListBoxItem>
<ListBoxItem>50</ListBoxItem>
<ListBoxItem>60</ListBoxItem>
<ListBoxItem>70</ListBoxItem>
<ListBoxItem>80</ListBoxItem>
<ListBoxItem>90</ListBoxItem>
<ListBoxItem>100</ListBoxItem>
</ListBox>
</StackPanel>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Data
Namespace Canvas_Positioning_Properties
Public Partial Class Window1
Inherits Window
Public Sub ChangeBottom(sender As Object, args As SelectionChangedEventArgs)
Dim li4 As ListBoxItem = TryCast(TryCast(sender, ListBox).SelectedItem, ListBoxItem)
Dim myLengthConverter As New LengthConverter()
Dim db4 As [Double] = CType(myLengthConverter.ConvertFromString(li4.Content.ToString()), [Double])
Canvas.SetBottom(text1, db4)
Console.WriteLine(myLengthConverter.ConvertToString(Canvas.GetBottom(text1)))
End Sub
End Class
End Namespace
Related examples in the same category