title | description | ms.date | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|
How to: Bind to an Enumeration |
Learn how to bind to an enumeration by binding to the enumeration's GetValues method in Windows Presentation Foundation (WPF). |
03/30/2017 |
|
b9091eba-1119-424e-868b-d1a4168b3732 |
This example shows how to bind to an enumeration by binding to the enumeration's GetValues method.
In the following example, the xref:System.Windows.Controls.ListBox displays the list of xref:System.Windows.HorizontalAlignment enumeration values through data binding. The xref:System.Windows.Controls.ListBox and the xref:System.Windows.Controls.Button are bound such that you can change the xref:System.Windows.FrameworkElement.HorizontalAlignment%2A property value of the xref:System.Windows.Controls.Button by selecting a value in the xref:System.Windows.Controls.ListBox.
[!code-xamlBindToEnum#BindToEnum]