'宣言 Public Shared ReadOnly MoveSelectedUpCommand As RoutedCommand
public static readonly RoutedCommand MoveSelectedUpCommand
Private Sub AssignCommandToMenuItem(ByVal menuItem As MenuItem, ByVal command As String, ByVal navPaneOptions As NavigationPaneOptionsControl) Select Case command Case "Save" menuItem.Command = NavigationPaneOptionsControlCommands.CommitChangesAndCloseCommand Exit Sub Case "Down" menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedDownCommand Exit Sub Case "Up" menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedUpCommand Exit Sub Case "Reset" menuItem.Command = NavigationPaneOptionsControlCommands.ResetGroupSequenceAndVisibilityCommand Exit Sub End Select menuItem.CommandTarget = navPaneOptions End Sub
void AssignCommandToMenuItem(MenuItem menuItem, string command, NavigationPaneOptionsControl navPaneOptions) { switch (command) { case "Save": menuItem.Command = NavigationPaneOptionsControlCommands.CommitChangesAndCloseCommand; break; case "Down": menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedDownCommand; break; case "Up": menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedUpCommand; break; case "Reset": menuItem.Command = NavigationPaneOptionsControlCommands.ResetGroupSequenceAndVisibilityCommand; break; } menuItem.CommandTarget = navPaneOptions; }