Silverlight Togglebutton Set IsPressed状态

问题描述:

你好,我在Silverlight中有一个切换按钮。
我想将其状态设置为“按下”。Silverlight Togglebutton Set IsPressed状态

首先我想:

btButton.IsPressed = true 

但是,这并不工作(只读)。
然后我尝试:

btButton.SetValue(ToggleButton.IsPressedProperty, true); 

这也不起作用。 我该如何做到这一点?我会假设它不会那么难...

使用IsChecked。 IsPressed会告诉您鼠标或空格键是否正在按下按钮。 IsChecked告诉你按钮是如何切换的。

btButton.IsChecked = true; 
+0

那么事后很容易。然而,你为我节省了很多时间和挫折。谢谢。 – 2010-09-02 05:22:01