Set Selected Item of WPF Combobox to User Setting -


i have combo box item source set collection of 'category'. selectedvaluepath categoryid property. have user setting 'defaultcategory' integer of should set categoryid. want combo box have selection of defaultcategory user setting.

xmlns:my="clr-namespace:myapp"  <combobox x:name="cmbcategory" displaymemberpath="category" selectedvaluepath="categoryid" selectedvalue="{binding source={x:static my:mysettings.default}, path=defaultcategory, mode=twoway}"/> 

you create additional application setting called defaultcategory_selected of type int , scope of user, , binding selectedindex property setting.

<combobox selectedindex="{binding path=defaultcategory_selected, mode=twoway}" ... /> 

Comments

Popular posts from this blog

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

web applications - Making Python scripts work on MAMP -

cocoa - Converting NSString to keyCode+modifiers for AXUIElementPostKeyboardEvent -