コード例 #1
0
        /// <include file='doc\ObjectList.uex' path='docs/doc[@for="ObjectList.PreShowItemCommands"]/*' />
        public void PreShowItemCommands(int itemIndex)
        {
            // Called just before commands are shown for a given item. We call 
            // an event handler that can modify (or even replace) the commands collection,
            // but first we mark the collection, and save it off, so that we can 
            // save the state of the collection at this point.

            if (_commands != null)
            {
                _globalCommands = _commands;
                _commands.GlobalStateSet();
            }

            SelectedIndex = itemIndex;

            ObjectListShowCommandsEventArgs eventArgs = 
                new ObjectListShowCommandsEventArgs(Selection, Commands);
            OnShowItemCommands(eventArgs);
            if (eventArgs.Commands != _commands)
            {
                _commands = eventArgs.Commands;
            }
        }
コード例 #2
0
 /// <include file='doc\ObjectList.uex' path='docs/doc[@for="ObjectList.OnShowItemCommands"]/*' />
 protected virtual void OnShowItemCommands(ObjectListShowCommandsEventArgs e) 
 {
     ObjectListShowCommandsEventHandler onShowItemCommandsHandler
         = (ObjectListShowCommandsEventHandler)Events[EventShowItemCommands];
     if (onShowItemCommandsHandler != null)
     {
         onShowItemCommandsHandler(this, e);
     }
 }