c# - Unfounded compilation error in VisualStudio 2012 -
visual studio's c# compiler propmts error has no base: "no overload 'itemselection' matches delegate 'onitemselected' in mainpage.xaml" (or blind , can't see error) earlier project compiled, despite fact error appeared, doesn't (what strange). thank help.
//mainpage.xaml <listbox.itemtemplate> <datatemplate> <local:wordblock word="{binding}" onslideoccured="onslide" onitemselection="itemselection"/> </datatemplate> </listbox.itemtemplate> //mainpage.xaml.cs private void itemselection(string word) { tosearch = word; (panorama.items[0] panoramaitem).visibility = visibility.collapsed; panorama.setvalue(panorama.selecteditemproperty, panorama.items[0]); panorama.measure(new size(double.positiveinfinity, double.positiveinfinity)); (panorama.items[0] panoramaitem).visibility = visibility.visible; } //wordblock.xaml.cs public delegate void onitemselected(string word); public event onitemselected onitemselection;
apparently event used in xaml require first parameter of type object. changing delegate to:
public delegate void onitemselected(object sender,string word);
and handler to:
private void itemselection(object sender,string word)
seem fix compilation problem (or use eventhandler<string>
event type).
Comments
Post a Comment