'宣言 Public Shared ReadOnly ShowFewerButtonsCommand As RoutedCommand
public static readonly RoutedCommand ShowFewerButtonsCommand
Private Sub WindowXOB_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim binding As Binding ' move up btnDown.Command = OutlookBarCommands.GroupMoveDownCommand binding = New Binding("SelectedGroup") binding.Source = Me.xamOutlookBar1 btnDown.SetBinding(Button.CommandTargetProperty, binding) ' move down btnUp.Command = OutlookBarCommands.GroupMoveUpCommand binding = New Binding("SelectedGroup") binding.Source = Me.xamOutlookBar1 btnUp.SetBinding(Button.CommandTargetProperty, binding) ' select group 1 btnSelect1.Command = OutlookBarCommands.GroupMoveUpCommand btnSelect1.CommandTarget = Me.xamOutlookBar1 btnSelect1.CommandParameter = Me.xamOutlookBar1.Groups("Group1") ' select group 2 btnSelect2.Command = OutlookBarCommands.GroupMoveUpCommand btnSelect2.CommandTarget = Me.xamOutlookBar1 btnSelect2.CommandParameter = Me.xamOutlookBar1.Groups("Group2") ' show more buttons btnMore.Command = OutlookBarCommands.ShowMoreButtonsCommand btnMore.CommandTarget = Me.xamOutlookBar1 ' show fewer buttons btnFewer.Command = OutlookBarCommands.ShowFewerButtonsCommand btnFewer.CommandTarget = Me.xamOutlookBar1 ' show options btnOptions.Command = OutlookBarCommands.ShowOptionsCommand btnOptions.CommandTarget = Me.xamOutlookBar1 ' shou popup wheh xamOutlookBar1 is minimized btnPopup.Command = OutlookBarCommands.ShowPopupCommand btnPopup.CommandTarget = Me.xamOutlookBar1 End Sub
void WindowXOB_Loaded(object sender, RoutedEventArgs e) { Binding binding; // move up btnDown.Command = OutlookBarCommands.GroupMoveDownCommand; binding = new Binding("SelectedGroup"); binding.Source = this.xamOutlookBar1; btnDown.SetBinding(Button.CommandTargetProperty, binding); // move down btnUp.Command = OutlookBarCommands.GroupMoveUpCommand; binding = new Binding("SelectedGroup"); binding.Source = this.xamOutlookBar1; btnUp.SetBinding(Button.CommandTargetProperty, binding); // select group 1 btnSelect1.Command = OutlookBarCommands.GroupMoveUpCommand; btnSelect1.CommandTarget = this.xamOutlookBar1; btnSelect1.CommandParameter = this.xamOutlookBar1.Groups["Group1"]; // select group 2 btnSelect2.Command = OutlookBarCommands.GroupMoveUpCommand; btnSelect2.CommandTarget = this.xamOutlookBar1; btnSelect2.CommandParameter = this.xamOutlookBar1.Groups["Group2"]; // show more buttons btnMore.Command = OutlookBarCommands.ShowMoreButtonsCommand; btnMore.CommandTarget = this.xamOutlookBar1; // show fewer buttons btnFewer.Command = OutlookBarCommands.ShowFewerButtonsCommand; btnFewer.CommandTarget = this.xamOutlookBar1; // show options btnOptions.Command = OutlookBarCommands.ShowOptionsCommand; btnOptions.CommandTarget = this.xamOutlookBar1; // shou popup wheh xamOutlookBar1 is minimized btnPopup.Command = OutlookBarCommands.ShowPopupCommand; btnPopup.CommandTarget = this.xamOutlookBar1; }