Pregunta

In a Windows 8 Metro application, I have a Combobox and I would like to call a method every time I select something else from the list.

I have my Method, and with ValueChanged="MyMethod" of a Slider, it works fine.

However, when i try with a combobox:

<ComboBox x:Name="Mentality" SelectedValue="Item1" SelectionChanged="MyMethod" >
                <x:String>Item1</x:String>
                <x:String>Item2</x:String>
                <x:String>Item3/x:String>

I have this error:

No overload for 'MyMethod' matches delegate Windows.UI.Xaml.Controls.SelectionChangedEventHandler'

¿Fue útil?

Solución

ValueChanged and SelectionChanged have different signatures. You can't use the same handler for both.

To wire up to SelectionChanged, you would need a method like this:

void MyMethod(object sender, SelectionChangedEventArgs e)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top