Problem setting selectedvalue for combobox in xaml

前端 未结 2 1759
难免孤独
难免孤独 2021-01-21 04:51

Here is a snippet of my xaml:

    
        100         


        
2条回答
  •  抹茶落季
    2021-01-21 05:06

    The selected value in this case is from type ComboBoxItem and not integer or string as you wished.

    so what can you do against that? there exists a property for the combobox which defines which property of the selected object should be used as value and which as DisplayMember (the visualization)

    in your case you have to set the SelectedValuePath to "Content". (The 200 are in your case the content of the ComboBoxItem)

    example:

    
        100
        200
    
    

提交回复
热议问题