如何在不使用WPF控件的情况下编写按钮事件?

时间:2021-01-08 13:58:03

I do not know how to specify in the title, this is in WPF visual basic. I want to know how do I write a code so that when a button is clicked, the tabcontrol selection will be = 1

我不知道如何在标题中指定,这是在WPF visual basic中。我想知道如何编写代码,以便当单击按钮时,tabcontrol选项将为= 1。

Here is what I have in my MainWindow, RightWindowCommands:

这是我在我的主窗口中,右边的命令:

 <Button Content="Information" Cursor="Hand" Click="InformationButton_OnClick"
                      ToolTip="View the information"
                      x:Name="InformationView"/>

However, I did not use the WPF tools' Button, as this is a GUI that I have to place the button at RightWindowCommands, I want to know how to come out with the code so that InformationButton_OnClick gives me tabControl.SelectedIndex = 1. Please guide me on writing this code out

但是,我没有使用WPF工具的按钮,因为这是一个GUI,我必须将按钮放在right twindowcommands,我想知道如何输出代码,以便InformationButton_OnClick给我tabControl。SelectedIndex = 1。请指导我把这段代码写出来

1 个解决方案

#1


0  

Here is a nice example for onclick event handling a picture, you can change it to a number instead of picture.

这里有一个处理图片的onclick事件的很好的例子,您可以将它更改为数字而不是图片。

`AddHandler pic.Click, AddressOf pic_Click'

Private Sub pic_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim pic As PictureBox = DirectCast(sender, PictureBox)
    ' etc...
End Sub

Source : add on click event to picturebox vb.net

源:添加点击事件到图片框vb.net

#1


0  

Here is a nice example for onclick event handling a picture, you can change it to a number instead of picture.

这里有一个处理图片的onclick事件的很好的例子,您可以将它更改为数字而不是图片。

`AddHandler pic.Click, AddressOf pic_Click'

Private Sub pic_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim pic As PictureBox = DirectCast(sender, PictureBox)
    ' etc...
End Sub

Source : add on click event to picturebox vb.net

源:添加点击事件到图片框vb.net