Class MainWindow Protected Overrides Sub OnContentRendered(e As System.EventArgs) MyBase.OnContentRendered(e) Dim sp As New StackPanel Dim sc As New ScrollViewer Dim btn As New Button btn.Content = "Hoi-1" btn.Tag = "25" btn.Height = 50 btn.Width = 100 sp.Children.Add(btn) AddHandler btn.Click, AddressOf btnClick CV.Children.Add(sp) btn = New Button btn.Content = "Hoi-2" btn.Tag = "35" btn.Height = 50 btn.Width = 100 sp.Children.Add(btn) AddHandler btn.Click, AddressOf btnClick End Sub Private Sub btnClick(sender As Object, e As RoutedEventArgs) Dim item As Button = DirectCast(sender, Button) Debug.Print(item.Tag) Debug.Print(item.Height) Debug.Print(item.Width) End Sub End Class
If I press a button I end up in the event BtnClick. I want toknow what the top and left value is of the button. Thank you.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)