我有MenuItem列表和使用ApplicationCommnds喜歡剪切,複製,粘貼。我想做一些事情時,Command是disable.But樣式不工作它。ApplicationCommand默認行爲是ii自動設置如果它禁用,前景灰色。但它不適用於我的情況。所以我明確地嘗試設置它。風格不適用於應用程序命令
<TextBox x:Name="AssignmentTextBox" >
<TextBox.ContextMenu>
<ContextMenu Background="White">
<MenuItem Command="ApplicationCommands.Undo" Style="StaticResource _MenuItem}"/>
<Separator />
<MenuItem Command="ApplicationCommands.Cut" Style="{StaticResource _MenuItem}"/>
<MenuItem Command="ApplicationCommands.Copy" Style="{StaticResource _MenuItem}" />
<MenuItem Command="ApplicationCommands.Paste" Style="{StaticResource _MenuItem}"/>
<Separator />
<MenuItem Command="ApplicationCommands.SelectAll" Style="{StaticResource _MenuItem}"/>
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
樣式聲明是什麼樣的? – OmegaMan
哪裏定義了_MenuItem風格?在應用程序資源?或某處? – Somnath
你想做什麼「某件事」? menutiem或其他項目的風格變化,代碼觸發器,什麼樣的? – iltzortz