WPF C# Tutorial

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="Canvas_Positioning_Properties.Window1"
    Title="Canvas Positioning Properties">
  
    
        A TextBlock.
  
      
      Auto      
      10
      20
      30
      40
      50
      60
      70
      80
      90
      100  
       
  
        

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
namespace Canvas_Positioning_Properties
{
  public partial class Window1 : Window
  {
    public void ChangeBottom(object sender, SelectionChangedEventArgs args)
    {
            ListBoxItem li4 = ((sender as ListBox).SelectedItem as ListBoxItem);
            LengthConverter myLengthConverter = new LengthConverter();
      Double db4 = (Double)myLengthConverter.ConvertFromString(li4.Content.ToString());
      Canvas.SetBottom(text1, db4);
      Console.WriteLine(myLengthConverter.ConvertToString(Canvas.GetBottom(text1)));
            
        }
  }
}