Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports Telerik.Windows.Data
Imports Telerik.Windows.Controls
Imports Telerik.Windows.Controls.GridView

Namespace RadGridView_WPF_AR_162
	''' <summary>
	''' Interaction logic for MainWindow.xaml
	''' </summary>
	Partial Public Class MainWindow
		Inherits Window

		Public Sub New()
			InitializeComponent()
			clubsGrid.Columns.Add(New MyButtonColumn() With {.Header = "Button Column"})
			Me.AddHandler(MyButtonColumn.PreviewMouseDownEvent, New MouseButtonEventHandler(AddressOf onMouseDown_Renamed), True)
		End Sub

'INSTANT VB NOTE: The method onMouseDown was renamed since Visual Basic does not allow same-signature methods with the same name:
		Private Sub onMouseDown_Renamed(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
			Dim button = (TryCast(e.OriginalSource, UIElement)).ParentOfType(Of Button)()
			If button IsNot Nothing Then
				Dim item = TryCast(button.ParentOfType(Of GridViewRow)().Item, Club)
				MessageBox.Show(item.Name.ToString())
			End If
		End Sub

		Private Sub Button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

		End Sub

		Private Sub Button2_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

		End Sub
	End Class
End Namespace
