2013-01-11 16 views
0

我有一個單選按鈕,我已經創建編程,並在某些情況下,我需要使此單選按鈕只讀。我也試過RadioButton.IsEnable = false;但在此之後,我的應用程序中沒有顯示任何內容,它看起來像可見性。單選按鈕的混亂。如何使單選按鈕只讀在運行時

此代碼爲創建單選按鈕我使用:

RadioButton radbtn = new RadioButton(); 
       radbtn.Name = choicelist[ctr].ID; 
       radbtn.Content = choicelist[ctr].Name; 
       radbtn.Foreground = new SolidColorBrush(Colors.Black); 
       radbtn.VerticalAlignment = System.Windows.VerticalAlignment.Center; 

我想爲只讀設置此單選按鈕。

+0

如何將按鈕添加到UI?我不明白爲什麼「IsEnable = false」不起作用。 –

回答

0

嗨,我找到了解決方案,它適用於我。

radbtn.IsHitTestVisible = false; 
相關問題