void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
// If the user is clicking the scrollbar (the arrow
// or the "thumb"), don't attempt to open an item in the browser
IInputElement element = e.MouseDevice.DirectlyOver;
if (element != null && element is FrameworkElement)
{
var elementType = element.GetType();
if (elementType == typeof(System.Windows.Controls.Primitives.RepeatButton) ||
elementType == typeof(System.Windows.Controls.Primitives.Thumb))
{ return; }
}
if (ResultGrid.SelectedItem == null) return;
AmazonItem item = ResultGrid.SelectedItem as AmazonItem;
if (item.URL == null)
{
MessageBox.Show("The item's URL cannot be parsed.");
return;
}
OpenWebpage(item.URL.ToString());
}