我有一個自定義標題欄,我使用了 WindowChrome。
為了使按鈕可點擊,我必須設定WindowChrome.IsHitTestVisibleInChrome為true,這在 xaml 上很簡單。
<Button x:Name="MyButton" WindowChrome.IsHitTestVisibleInChrome="true" />
但是,我怎樣才能以編程方式做同樣的事情?
默認情況下,我必須設定WindowChrome.IsHitTestVisibleInChromeintofalse然后它需要在代碼的后面設定為 true。
我試過MyButton.IsHitTestVisible = true;了,但這似乎不起作用?
uj5u.com熱心網友回復:
這是您以編程方式設定WindowChrome.IsHitTestVisibleInChrome附加屬性的方式:MyButton
System.Windows.Shell.WindowChrome.SetIsHitTestVisibleInChrome(MyButton, true);
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/460096.html
