Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-use-a-thicknessconverter-object.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.0 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Use a ThicknessConverter Object 03/30/2017
csharp
vb
border thickness [WPF]
ThicknessConverter objects [WPF]
52682194-d7fd-499c-8005-73fcc84e7b2c

How to: Use a ThicknessConverter Object

Example

This example shows how to create an instance of xref:System.Windows.ThicknessConverter 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 xref:System.Windows.Controls.ListBoxItem, as defined in a separate [!INCLUDETLA#tla_xaml] file, to an instance of xref:System.Windows.Thickness, and later converts the content into a xref:System.String. This method passes the xref:System.Windows.Controls.ListBoxItem to a xref:System.Windows.ThicknessConverter object, which converts the xref:System.Windows.Controls.ContentControl.Content%2A of a xref:System.Windows.Controls.ListBoxItem to an instance of xref:System.Windows.Thickness. This value is then passed back as the value of the xref:System.Windows.Controls.Border.BorderThickness%2A property of the xref:System.Windows.Controls.Border.

This example does not run.

[!code-csharpThicknessConverter#1] [!code-vbThicknessConverter#1]

See also