Hi there,
I have created a listbox inside my data template I have a textblock with the LeftMouseButtonDown event hooked into it. I have a basic little event like this.
private void txtRewardDescription_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
try
{
RewardDetail selectedItem = (RewardDetail)lstAvailableRewards.SelectedItem;
MessageBox.Show(string.Format("Selected Reward is - {0}",selectedItem.RewardDescription));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Now my problem is the 1st time I click on an item within the list I get the Object reference error however if i press it again I get the details I was expecting.
What am I doing wrong?
Thank you