Wednesday, 15 January 2014

wpf - Binding combobox selected value to property -



wpf - Binding combobox selected value to property -

i have enum animals fish , cat values inside.

public observablecollection<animalsenum> animals { get; set; }

i bind enum shown in combobox.

<combobox itemssource="{binding path=animals }">

i have property called animalschanged of type animalsenum

when take animal the combobox, want property called animalschanged value of enum combobox.

how do xaml ? idea

thanks

use selecteditem bind actual info item list. selectedvalue can bind specific property selecteditem. binds 2 way default don't need specify that:

<combobox itemssource="{binding path=animals }" selecteditem="{binding animalschanged}">

wpf binding combobox

No comments:

Post a Comment