Version

Working with Commands (XamSpreadsheet)

Purpose

This topic explains how to perform different operations with the control using commands.

Required background

The following table lists the concept and topics required as a prerequisite to understanding this topic.

Type Content

Concept

Infragistics Excel Engine

Topic Purpose

In this section you will find information that will help you to better understand the object model and the functionalities of the Infragistics Excel Engine .

This topic explains in details the features of the XamSpreadsheet control from developer perspective.

This topic provides an overview of the visual elements of the XamSpreadsheet control.

Commands Introduction

Commands summary

The XamSpreadsheet control provides a lot of commands for activating different features by instantiating the SpreadsheetCommandSource type. You can find the full list of commands in the SpreadsheetCommandType enumeration.

Note
Note

Some of the commands (like Clipboard commands or Undo/Redo commands) are mapped to the routed commands in the ApplicationCommands class, and also some editing commands (like alignments or text styling) are mapped to the routed commands in the EditingCommands class.

Note
Note

Many xamSpreadsheet’s commands will affect all user selected worksheets.

Code Example: Invoking a Command in XAML

Description

The following code snippet shows how to invoke a command in XAML on the xamSpreadsheet control using a button. The code snippet assumes you have a reference to a xamSpreadsheet instance named "xamSpreadsheet1".

Code

Following is the code that implements this example.

In XAML:

<Page
  …
  xmlns:ig="http://schemas.infragistics.com/xaml"
  xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives"
  …>
<Button Content="Zoom to 100%"
  ig:Commanding.CommandTarget="{Binding ElementName=xamSpreadsheet1}">
  <ig:Commanding.Command>
    <igPrim:SpreadsheetCommandSource
      EventName="Click"
      CommandType="ZoomTo100" />
  </ig:Commanding.Command>
</Button>

Code Example: Invoking a Command in Code

Description

The following code snippet shows how to invoke a command in code on the xamSpreadsheet control. The code snippet assumes you have a reference to a xamSpreadsheet instance named "xamSpreadsheet1".

Code

Following is the code that implements this example.

In C#:

using Infragistics.Controls.Grids;
using Infragistics.Controls.Grids.Primitives;
...
SpreadsheetCommand cmd = new SpreadsheetCommand(SpreadsheetCommandType.ToggleCellEditMode);
cmd.Execute(this.XamSpreadsheet1);

In Visual Basic:

Import Infragistics.Controls.Grids
Import Infragistics.Controls.Grids.Primitives
...
Dim cmd As New SpreadsheetCommand(SpreadsheetCommandType.ToggleCellEditMode)
cmd.Execute(Me.XamSpreadsheet1)

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the activation feature from developer perspective.

This topic explains the selection feature from developer perspective.

This topic explains how to configure and perform undo and redo operations with the control.