xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ThicknessConverter_Csharp.Window1"
Title="ThicknessConverter Sample">
ThicknessConverter Sample
Change the BorderThickness Property:
0
5
10
15
20
25
30
35
40
45
50
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Media;
namespace ThicknessConverter_Csharp
{
public partial class Window1 : Window
{
public void changeThickness(object sender, SelectionChangedEventArgs args)
{
ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);
ThicknessConverter myThicknessConverter = new ThicknessConverter();
Thickness th1 = (Thickness)myThicknessConverter.ConvertFromString(li.Content.ToString());
border1.BorderThickness = th1;
bThickness.Text = "Border.BorderThickness =" + li.Content.ToString();
}
}
}