Building Silverlight 2 Applications (Parts 1 and 2)

Slides:



Advertisements
Similar presentations
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

Developing Rich Web Applications with Silverlight Mike Ormond Developer & Platform Group Microsoft Ltd
ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
Scenario Fixed look with some logic Split large page into smaller chunks Reuse xaml/logic in multiple places Platform Support … … public partial.
Daniel Moth Microsoft
Mark Rees Microsoft Consulting Services OFC409 Windows Workflow Foundation (WF) Primer Creating WF programs in Visual Studio Creating workflow templates.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
Interactivity Navigating a data model Working with large quantities of data Entry Editing and adding data User feedback and validation Presentation.
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
Silverlight Development Win Phone 7 Mohammed M. Melhem Senior ICT Assistant: Application Silverlight and Win Phone.
BESUG Keynote  Gill Cleeren Microsoft Regional Director Benelux MVP ASP.NET Software architect Ordina  Blog:  Mail:
Powerful, modern desktops enable next generation applications Hardware acceleration brings real-time lighting, texturing and rendering Visual.
300MM active users worldwide Worldwideleadership.
travel Suru Windows 7 Release NET 4.0 / Surface 2.0 Release Multi-Touch Controls Multi-Touch API Surface Multi-Touch Controls & API Surface.
2 A First Look at Windows Presentation Foundation Everywhere ("WPF/E") Joe Stegman Lead Program Manager Microsoft Corporation.
Web programmeringSilverlight NOEA / PQC 2007 Silverlight From: Gill Cleeren blog.n-technologies.be.
Target: dependency property Source: any public property CLR and WPF properties Target: dependency property Source: any public property CLR and WPF properties.
Rudi Grobler Session Code: WUX205.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Understand what kind of applications Windows Presentation Foundation can deliver See how Visual Studio 2008 & Microsoft Expression Blend work together.
Building RIA for Desktop, Web and Mobile using Silverlight and WPF Giorgio Sardo UX Consultant, Microsoft UK blogs.msdn.com/Giorgio.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Tony Goodhew Product Planner DEV328.
The Microsoft Technical Roadshow 2007 Rich Client Development in XAML Mark Johnston Developer & Platform Group Microsoft Ltd
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Presentation advances in.NET Framework 3.0 Mark Johnston Developer & Platform Group, Microsoft Ltd
Jaime Rodriguez | Microsoft Principal Technical Evangelist Laurent Bugnion | IdentityMine Senior Director XAML Deep Dive for Windows & Windows Phone Apps.
Overview of Silverlight Mike Taulty Developer & Platform Group Microsoft Ltd
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

Silverlight 2 Andrew Pardoe Program Manager CLR Execution Engine
Quick overview of ASP.NET Ajax Ajax deep-dive Cover some key real-world problems Discuss solutions, patterns, opportunities Lots of demos And more of.
Mike Taulty Developer & Platform Group Microsoft Ltd
1 Catching up on Rich Clients (round 1) Mike Ormond, Mike Taulty Developer & Platform Group Microsoft Ltd
demo Demo.
Silverlight 101 Ahead! If you know Silverlight and are looking for more advanced content check out : ‘Microsoft Silverlight “Media” : Moving at 60fps’
Eben de Wit Developer Advisor Microsoft
An Introduction to Developing Applications for Microsoft Silverlight Jaime Rodriguez
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

Part of the Microsoft.NET Framework 3.0 Tomer Shamam.NET Technologies Expert Sela Group
Daniel Moth Microsoft
Introduction to Silverlight Development Pavel Yosifovich CTO, Matrix Global; Senior Instructor, Hi-Tech College
1/10/2018 9:33 PM Cloud Roadshow © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO.
DoRon Motter Development Lead Microsoft Corporation
Windows Azure Jeffrey Ferman Program Manager 3-006
6/10/ :23 PM TOOL-504T A deep dive into Visual Studio 11 Express for designing Metro style apps using XAML Joanna Mason & Unni Ravindranathan Program.
9/11/ :22 PM What’s New for Silverlight and Windows Presentation Foundation (WPF) Developers in Microsoft Visual Studio 2010 Mark A Wilson-Thomas.
Manual testing of Windows Metro style apps built using HTML
Building beautiful and interactive apps with HTML5 & CSS3
Building Awesome HTML Applications in Blend for Windows 8
WPF AKEEL AHMED.
Enterprise Metadata in SharePoint 2013
MIX 09 11/24/2018 9:18 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Search: integrating into the Windows 8 search experience
Overview of Silverlight 2
MIX 09 12/8/2018 4:33 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Sascha P. Corti Developer Evangelist Microsoft Switzerland sascha
DEV312 基于WPF的数据绑定.
Office 365 Development.
Build /10/2019 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Silverlight Debugging
Silverlight 2 Mike Taulty Developer & Platform Group Microsoft Ltd
4/20/2019 Share © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or.
Bringing existing managed code into Metro style apps
Tech Ed North America /6/2019 2:07 PM Required Slide
Presentation transcript:

Building Silverlight 2 Applications (Parts 1 and 2) Scott Guthrie scottgu@microsoft.com http://weblogs.asp.net/scottgu

What You'll Need: Install the following: Silverlight Tools for Visual Studio 2008 Beta 2 Expression Blend 2.5 June Preview Everything you need is at www.silverlight.net Links to downloads & docs VS object browser a great way to view APIs

demo Building Hello World

Loading a Silverlight Application…

Test.htm <html> <body> <object data="data:application/x-silverlight," type="application/x-silverlight-2-b1"> <param name="source“ value="ClientBin/SilverlightApplication1.xap"/> <a href="http://go.microsoft.com/fwlink/?LinkID=108182"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" /> </a> </object> <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe> </body> </html>

Running Application…

XAML, Shapes and Controls

XAML XAML = eXtensible Application Markup Language Flexible XML document schema Example usages: WPF, Silverlight, Workflow Foundation Enables rich tooling support While still preserving readability & hand-coding with text editors

Hello world XAML Sample <Grid> <TextBlock FontSize="32" Text="Hello world" /> </Grid> Hello world

Markup = Object Model <TextBlock FontSize="32" Text="Hello world" /> = TextBlock t = new TextBlock(); t.FontSize = 32; t.Text = "Hello world"; Anything that can be expressed in XAML can be programmatically coded as well

<TextBlock /> Hello Hello there, how are you? Hello Hello there, <TextBlock>Hello</TextBlock> Hello <TextBlock FontSize="18">Hello</TextBlock> Hello <TextBlock FontFamily="Courier New">Hello</TextBlock> Hello <TextBlock TextWrapping="Wrap" Width="100"> Hello there, how are you? </TextBlock> Hello there, how are you? Hello there, how are you? <TextBlock> Hello there,<LineBreak/>how are you? </TextBlock>

Shapes and Vector Graphics <Rectangle /> <Ellipse /> <Line /> <Polygon /> <PolyLine /> <Path />

Controls Re-usable UI elements that encapsulate UI and behavior and enable re-use and composition <Button x:Name=“MyButton” Content=“Push Me” Width=“150” Height=“50” /> Button b = new Button(); b.Width = 150; b.Height = 50; b.Content = “Push Me";

Silverlight Controls Form Controls: Navigation Controls: TextBox PasswordBox Button Toggle/Repeat Button CheckBox RadioButton ComboBox ListBox Navigation Controls: HyperlinkButton Popup Core Controls: Border Image MediaElement MultiScaleImage ToolTip ScrollViewer ProgressBar Layout Controls: StackPanel Grid / GridSplitter Canvas High-Level Controls: Calendar DataGrid Slider TabControl DateTimePicker Shapes: Ellipse Rectangle Line TextBlock Path

x:Name Name your controls so you can use it in code Visual Studio automatically declares field for all x:name elements <Button x:Name=“MyButton”/> public void Page_Loaded(sender, MouseEventArgs e) { MyButton.Content = “Push Me!”; }

Wiring Up Event Handlers Event handlers can be wired up declaratively in XAML: Or explictly within the code-behind file VB – using the "Handles" keyword C# -- programmatically within the Page_Loaded event handler <Button x:Name=“MyButton” Content=“Push Me” Click=“MyButton_Click“/> public void MyButton_Click(object sender, RoutedEventArgs e) { // todo: add code }

demo Controls

Layout

Layout Silverlight and WPF support concept of Layout Panels Canvas StackPanel Grid Layout system is customizable WrapPanel, DockPanel, TilePanel, RadialPanel, Etc.

Canvas Is a Drawing Surface Children have relative positions: <Canvas Width="250" Height="200"> <Rectangle Canvas.Top="25" Canvas.Left="25" Width="200" Height="150" Fill="Yellow" /> </Canvas> The Canvas The Rectangle

Attached Property Syntax <Canvas> <Rectangle Canvas.Top="25"/> </Canvas> Top property only make sense inside a Canvas When we add new container panels, do we have to add new properties to Rectangle? Solution: Use attached properties to add flexible, container specific customization

Attached Properties (2) <Rectangle Canvas.Top="25" Canvas.Left="25"/> = Rectangle rectangle = new Rectangle(); rectangle.SetValue(Canvas.TopProperty, 25); rectangle.SetValue(Canvas.LeftProperty, 25);

StackPanel <StackPanel Orientation="Vertical"> <Button>Button 1</Button> <Button>Button 2</Button> </StackPanel>

Grid Panel <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="100"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="75"/> <RowDefinition Height="*"/> <RowDefinition Height="85"/> </Grid.RowDefinitions> <Button Grid.Column="1" Grid.Row="1" Content=“Button 1" Margin="8,8,8,8"/> <Button Grid.Column="1" Grid.Row="2" Content=“Button 2" Margin="8,8,8,8"/> </Grid>

Tip: Dynamic Flow Layout Remove the top "Width" and "Height" attributes on your parent control in order to have Silverlight fill the entire HTML region your page provides it

demo Layout

Brushes

Brushes Determines how objects are painted Brush options include: For painting objects (e.g. Fill) For painting of lines (e.g. Stroke) Brush options include: Solid color brushes Gradient brushes Image brushes Video brushes

Brushes (2) <SolidColorBrush /> Support creation by name 141 named colors supported (e.g. Blue, Red, Green) Supports #FFFFFF or #FFFFFFFF syntax as well <Rectangle Width="200" Height="150" > <Rectangle.Fill> <SolidColorBrush Color="Black" /> </Rectangle.Fill> </Rectangle> <Rectangle Width="200" Height="150" Fill="Black" /> <Rectangle Width="200" Height="150" Fill="#FFFFFF" />

Brushes (3) <LinearGradientBrush /> Start and Stop are to set angle as numbers Gradient Stops are the different color points <Rectangle Width="200" Height="150"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <LinearGradientBrush.GradientStops> <GradientStop Color=“Blue" Offset="0" /> <GradientStop Color="Black" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle>

demo Brushes

Transformations All elements support them Transform Types <RotateTransform /> <ScaleTransform /> <SkewTransform /> <TranslateTransform /> Moves <MatrixTransform /> Scale, Skew and Translate Combined

Transformations (2) Hello World <TextBlock Text="Hello World"> <TextBlock.RenderTransform> <RotateTransform Angle="45" /> </TextBlock.RenderTransform> </TextBlock> Hello World

demo Transforms

Networking

Rich Networking Options Available HTTP WCF/SOAP REST RSS Sockets ADO.NET Data Services (aka "Astoria") Cross Domain Networking Support

demo Networking

Databinding

Databinding Enable clean view/model separation and binding Change UI presentation wtihout code-behind modifications Works with any object that implements IEnumerable Arrays, Lists, Collections, etc. Binding Expressions can be one way or two way INotifyPropertyChange change notifications supported

demo Databinding

User Controls Enable easy encapsulation and re-use of functionality Can be declaratively specified or procedurally created Can expose custom events and properties

demo User Controls

Styles

Styles Allow look and feel of a control to be defined externally Conceptually similar to Stylesheets with HTML Support encapsulating style properties and control templates Control templates particularly powerful (will see soon) Can be defined either within UI XAML files or App.xaml App.xaml allows use across all files in application

Styles

Styles

Styles

Control Templates

Control Templates Allow the visual tree of a control to be completely replaced and/or customized however you want Override not only the look and style – but also the feel Interaction behaviors, animations, etc. Enable clean designer/developer workflow

demo Content Templates

Visual State Manager Enables control to expose states and transitions to customize Eg: Pressed, Disabled, Focused, etc. Integrated designer support within Expression Blend to enable this

demo Content Templates

HTML Integration

Access the HTML DOM from Managed HTML access availble in new namespace using System.Windows.Browser; Static HtmlPage class provides entry point HtmlPage.Window.Navigate("http://www.microsoft.com"); String server = HtmlPage.Document.DocumentUri.Host; Hookup events, call methods, or access properties HtmlElement myButton = HtmlPage.Document.GetElementById("myButtonID"); myButton.AttachEvent("onclick", new EventHandler(this.myButtonClicked)); private void myButtonClicked(object sender, EventArgs e) { ... }

HTML Integration Scripting Integration: Allow JavaScript on the HTML page to call into Silverlight Allow Silverlight code to call JavaScript methods on HTML page Other interesting HTML integration scenarios: Persisent links Fwd/Back Integration

Open File Dialog Support

OpenFileDialog Silverlight supports ability to prompt for local files Developers can then work with file contents locally without having to first upload them to the server OpenFileDialog openFileDlg = new OpenFileDialog(); openFileDlg.EnableMultipleSelection = false; openFileDlg.Filter = "Text files (*.txt;*.xml)|*.txt;*.xml"; openFileDlg.Title = "Select an image to upload"; if (openFileDlg.ShowDialog() == DialogResult.OK) { // Do something with the file or files }

OpenFileDialog Security Constraints Silverlight does not allow developer to control or access the origional file path on the local machine Silverlight does not allow direct file access without first going through the OpenFileDialog

Isolated Storage Stream based access to a private file/directory structure Patterned after .NET Framework IsolatedStorage classes Read and write string or binary data Flexible user policy storage options

Summary Silverlight provides an incredibly powerful RIA platform Easy to deploy applications Easy to create great looking applications Easy to create fast and responsive applications All enabled cross platform and cross browser Silverlight enables a common programming model across browsers, mobile devices, and the desktop Silverlight 2 and associated tools will ship later this year

© 2007 Microsoft Corporation. All rights reserved © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.