--- title: "How to: Use a ThicknessConverter Object" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "border thickness [WPF]" - "ThicknessConverter objects [WPF]" ms.assetid: 52682194-d7fd-499c-8005-73fcc84e7b2c --- # How to: Use a ThicknessConverter Object ## Example This example shows how to create an instance of and use it to change the thickness of a border. The example defines a custom method called `changeThickness`; this method first converts the contents of a , as defined in a separate [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] file, to an instance of , and later converts the content into a . This method passes the to a object, which converts the of a to an instance of . This value is then passed back as the value of the property of the . This example does not run. [!code-csharp[ThicknessConverter#1](~/samples/snippets/csharp/VS_Snippets_Wpf/ThicknessConverter/CSharp/Window1.xaml.cs#1)] [!code-vb[ThicknessConverter#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ThicknessConverter/VisualBasic/Window1.xaml.vb#1)] ## See also - - - - [How to: Change the Margin Property](/previous-versions/dotnet/netframework-3.5/ms750561(v=vs.90)) - [How to: Convert a ListBoxItem to a new Data Type](/previous-versions/dotnet/netframework-3.5/ms749147(v=vs.90)) - [Panels Overview](../controls/panels-overview.md)