我可以使用文本块/文本作为按钮,我该怎么做? [英] can I use a textblock/text as a button, and how can I do that?

查看:61
本文介绍了我可以使用文本块/文本作为按钮,我该怎么做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力让文字表现为一个按钮,但我却无法让它发挥作用。

解决方案


这一切都取决于你想要它做多少。

基本要素是:

Xaml:

< TextBlock x:Name =" tbClickTest"的Horizo​​ntalAlignment = QUOT;左" VerticalAlignment = QUOT;陀螺"文本= QUOT; TextBlock的" TextWrapping = QUOT;包覆与QUOT; MouseLeftButtonDown =" tbClickTest_MouseLeftButtonDown" /> 


Code Behind:

 Private Sub tbClickTest_MouseLeftButtonDown( ByVal sender as Object,ByVal e as System.Windows.Input.MouseButtonEventArgs)
Msgbox(" Clicked")
End Sub


你可以做更多的事情,但是开始的方式是什么? />&NBSP;


I have been messing around with getting text to behave as a button but am thus far unable to get it to work.

解决方案

Yes

And it all depends on how much you want it to do.

The basics are:

Xaml:

<TextBlock x:Name="tbClickTest" HorizontalAlignment="Left" VerticalAlignment="Top" Text="TextBlock" TextWrapping="Wrap" MouseLeftButtonDown="tbClickTest_MouseLeftButtonDown"/>


Code Behind:

 Private Sub tbClickTest_MouseLeftButtonDown(ByVal sender as Object, ByVal e as System.Windows.Input.MouseButtonEventArgs)
    	Msgbox("Clicked")	
    End Sub


You can do a whole lot more but that the way to start

Stu
 


这篇关于我可以使用文本块/文本作为按钮,我该怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆