--- title: "How to: Produce a Value Based on a List of Bound Items" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "data binding [WPF], MultiBinding" - "Multibinding [WPF]" ms.assetid: b3d06378-b511-4181-95aa-316d60c9229b --- # How to: Produce a Value Based on a List of Bound Items allows you to bind a binding target property to a list of source properties and then apply logic to produce a value with the given inputs. This example demonstrates how to use . ## Example In the following example, `NameListData` refers to a collection of `PersonName` objects, which are objects that contain two properties, `firstName` and `lastName`. The following example produces a that shows the first and last names of a person with the last name first. [!code-xaml[MultiBinding#Resources1](~/samples/snippets/csharp/VS_Snippets_Wpf/MultiBinding/CSharp/Window1.xaml#resources1)] [!code-xaml[MultiBinding#Resources2](~/samples/snippets/csharp/VS_Snippets_Wpf/MultiBinding/CSharp/Window1.xaml#resources2)] [!code-xaml[MultiBinding#MultiBindingTextBox2](~/samples/snippets/csharp/VS_Snippets_Wpf/MultiBinding/CSharp/Window1.xaml#multibindingtextbox2)] [!code-xaml[MultiBinding#Window](~/samples/snippets/csharp/VS_Snippets_Wpf/MultiBinding/CSharp/Window1.xaml#window)] To understand how the last-name-first format is produced, let's take a look at the implementation of the `NameConverter`: [!code-csharp[MultiBinding#3](~/samples/snippets/csharp/VS_Snippets_Wpf/MultiBinding/CSharp/NameConverter.cs#3)] [!code-vb[MultiBinding#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/MultiBinding/VisualBasic/NameConverter.vb#3)] `NameConverter` implements the interface. `NameConverter` takes the values from the individual bindings and stores them in the values object array. The order in which the elements appear under the element is the order in which those values are stored in the array. The value of the attribute is referenced by the parameter argument of the method, which performs a switch on the parameter to determine how to format the name. ## See also - [Convert Bound Data](how-to-convert-bound-data.md) - [Data Binding Overview](data-binding-overview.md) - [How-to Topics](data-binding-how-to-topics.md)