VSTO Day ActionsPane e la gestione dei dati Gianluca Ciocci gciocci@shareoffice.it

Preview:

Citation preview

VSTO DayVSTO Day

ActionsPane e la gestione dei ActionsPane e la gestione dei datidati

www.shareoffice.it

Gianluca CiocciGianluca Cioccigciocci@shareoffice.itgciocci@shareoffice.it

AgendaAgenda

ActionsPaneActionsPane

SmartTagsSmartTags

Data and Data BindingData and Data Binding

ActionsPaneActionsPane

è l’implementazione dell’interfaccia è l’implementazione dell’interfaccia ISmartDocument (VSTO2005 Vers.)ISmartDocument (VSTO2005 Vers.)

Utilizzo semplificato da parte di uno sviluppatoreUtilizzo semplificato da parte di uno sviluppatore

Accesso OM ancora più semplice.Accesso OM ancora più semplice.

Estende l’Office Document Actions Task Estende l’Office Document Actions Task PanePane

Document-level controlDocument-level control

Completo supporto a controlli anche customCompleto supporto a controlli anche custom

Sensibile al contestoSensibile al contesto

ActionsPaneActionsPane

ActionsPane – Dev ExperienceActionsPane – Dev Experience

1. Design a

UserControl

2. Add control behaviour

3. Add the control to

the ActionsPan

e

ActionsPane – StackOrderActionsPane – StackOrder

NoneNone FromLeftFromLeftFromBottomFromBottom

FromTopFromTop FromRightFromRight

ActionsPane.StackOrder = Microsoft.Office.Tools.StackStyle. ...;

ActionsPane – OrientationActionsPane – Orientation

Office.CommandBar ap = Globals.ThisWorkbook.Application.CommandBars["Task Pane"]; ap.Position = Office.MsoBarPosition. ...;

msoBarRight

msoBarTop

msoBarBottom

msoBarLeft

ActionsPane – ScrollingActionsPane – Scrolling

Autoscrolling Verticale abilitatoAutoscrolling Verticale abilitato

Proprietà scrollingProprietà scrollingActionsPane.VerticalScrollActionsPane.VerticalScroll

ActionsPane.HorizontalScrollActionsPane.HorizontalScroll

ActionsPane – ArchitectureActionsPane – Architecture

Office Office Document Document

Actions Actions Task PaneTask Pane

VSTO VSTO Invisible Invisible ActiveX ActiveX ControlControl

WinForms WinForms UserControl UserControl (ActionsPan(ActionsPan

e)e)

ActionsPaneActionsPane.Controls.Controls

demo

ActionsPaneActionsPane

ActionsPane – Dinamic contextActionsPane – Dinamic context

1. Design multiple

UserControls

2. Map XML

schema

3. Code UserContr

ol behaviour

ActionsPane – Dinamic contextActionsPane – Dinamic context

4. Instantiate

UserControls

5. Hook up handlers for

Node navigation

events

6. Code event

handlers to add/remove UserControl

s

demo

Dinamic ActionsPaneDinamic ActionsPane

SmartTagsSmartTags

Mappano delle azioni su termini Mappano delle azioni su termini specifici, contenuti in un documento specifici, contenuti in un documento

Custom Recognizers Custom Recognizers Custom Custom ActionsActions

VSTO 2005: sviluppo di smart tag VSTO 2005: sviluppo di smart tag enormemente semplificatoenormemente semplificato

Terms e Regular expressionsTerms e Regular expressions

+ Action per un singolo smart tag+ Action per un singolo smart tag

SmartTags – User experienceSmartTags – User experience

SmartTags – Developer experienceSmartTags – Developer experience

demo

VSTO SmartTagsVSTO SmartTags

SmartTags – Custom recognizerSmartTags – Custom recognizer1. Import Smart

Tags 2.0 Library

2. Inherits SmartTag

Class

3. Implement base

constructor

4. Override the Recognize

method Me.VstoSmartTags.Add(New CarSmartTag())

5. Add the custom SmartTag to

VstoSmartTags collection

demo

VSTO Custom SmartTags recognizerVSTO Custom SmartTags recognizer

DataBindingDataBinding

Vediamo la via più facileVediamo la via più facile

demo

VSTO Data BindingVSTO Data BindingThe easy way

DataBinding – The modelDataBinding – The model

Data Binding

Data Binding

Data Source

Host Item Controls

Workbook/Document

Optional XML Data Island

Optional Optional DataData

CachingCaching

Data Data AdaptorAdaptor

Typed DataSet

BindingSource

Defined byDefined by

CustomerDataSet.xsd

VSTO Data Binding SupportVSTO Data Binding Support

E’ necessario che I controlli derivano da E’ necessario che I controlli derivano da BindableComponentBindableComponent

DataBindings collection propertyDataBindings collection property

myNamedRange1.DataBindings.Add()myNamedRange1.DataBindings.Add()

BindingSourceBindingSourceDataSource DataSource DataSet DataSet

DataMember DataMember DataTable DataTable

Update DataSet dal Data BindingsUpdate DataSet dal Data Bindings

Update DataSource tamite DataAdaptorUpdate DataSource tamite DataAdaptor

Excel ListObjectExcel ListObject

Complex DataBindingComplex DataBinding

Estende le funzionalità native di ExcelEstende le funzionalità native di ExcelNuovi metodi, proprietà, eventiNuovi metodi, proprietà, eventi

Deriva da BindableComponentDeriva da BindableComponent

Databind con data source “bindabili”Databind con data source “bindabili”DataSet, DataTable, DataViewDataSet, DataTable, DataView

Array, IList, IListSource, BindingList<> Array, IList, IListSource, BindingList<>

SQL stored procedure, XML, web servicesSQL stored procedure, XML, web services

Aggancio a design-time e a run-timeAggancio a design-time e a run-time

Static ListObjectStatic ListObject

Dinamic ListObjectDinamic ListObject

demo

VSTO Data BindingVSTO Data BindingWorking with ListObject

Domande?

Registratevi su www.shareoffice.it

Stay tuned!

© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.