public ObservableCollection<WordList> MyWordList { get; set; }
public DictionaryPage()
{
InitializeComponent();
BindingContext = new DictionaryPageViewModel();
MyWordList = new ObservableCollection<WordList>
{
new WordList { Color = "Red", Letter = "A", Word = "Abdomen", Meaning = "Mean : " + "Mean",Detail= "Mean", Voice = "myVoice.mp3" }
};
}
private async void PronunciationButton_Clicked(object sender, System.EventArgs e)
{
await CrossMediaManager.Current.PlayFromAssembly("HERE HERE HERE");
}
I have an observable collection like this and I want to put the voice value in it to the button event below. Thanks for your help
MyWordList
is a class level variable. Just reference it in your Clicked
handler
private async void PronunciationButton_Clicked(object sender, System.EventArgs e)
{
For each (var word in MyWordList) {
await CrossMediaManager.Current.PlayFromAssembly(word.Voice);
}
}