Introdução ao Windows Presentation Foundation (WPF)

24
Introdução ao Windows Presentation Foundation (WPF) Sara Silva http://netponto.org 6ª Reunião Presencial 23/01/2010

description

Apresentação de introdução ao Windows Presentation Foundation (WPF), seguida de várias demonstrações práticas sobre utilização dos diferentes controlos de layout, como Grid, Canvas, DockPanel, entre outros... Utilização dos controlos DataGrid, Calendar e DatePicker do WPF Toolkit e a Ribbon Bar. do Office UI, e criação de Resources e Styles, na 6ª reunião presencial da comunidade NetPonto

Transcript of Introdução ao Windows Presentation Foundation (WPF)

Page 1: Introdução ao Windows Presentation Foundation (WPF)

Introdução ao Windows Presentation Foundation (WPF)

Sara Silva

http://netponto.org6ª Reunião Presencial – 23/01/2010

Page 2: Introdução ao Windows Presentation Foundation (WPF)

Sara Silva

3 anos de experiência profissional em TI

Lic. Matemática: Especialização em Computação - DMUC

MCPD: Windows Developer 3.5

MCTS: WPF 3.5 e Windows Forms 3.5

Page 3: Introdução ao Windows Presentation Foundation (WPF)

Agenda• Introdução ao WPF

• Tipos de Aplicações

• Interface com o Utilizador- Layout e Controlos- WPFToolkit e WPF Ribbon

• Resources

• Styles

Page 4: Introdução ao Windows Presentation Foundation (WPF)

Introdução ao WPFArquitectura

Page 5: Introdução ao Windows Presentation Foundation (WPF)

Introdução ao WPFClasses

Page 6: Introdução ao Windows Presentation Foundation (WPF)

Introdução ao WPF

XAML = Extensible Application Markup Language

<Button Width="100"> OK<Button.Background>LightBlue

</Button.Background></Button>

XAML

Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush(Colors.LightBlue);b1.Width = 100;

C#

Dim b1 As New Buttonb1.Content = "OK"b1.Background = New _

SolidColorBrush(Colors.LightBlue)b1.Width = 100

VB.NET

Page 7: Introdução ao Windows Presentation Foundation (WPF)

Tipos de Aplicações

Top-Level UI Object WPF Applications VS2008 Projects

Window Windows Application WPF Application

Page Navigation Application WPF Application

Page Xaml Browser Applications (XBAPs) WPF Browser Application

Page 8: Introdução ao Windows Presentation Foundation (WPF)

Dos tipos de aplicações no Visual Studio 2008

Page 9: Introdução ao Windows Presentation Foundation (WPF)

Interface com o utilizador• ControlLayout

– Grid

– Canvas

– DockPanel

– StackPanel

– WrapPanel

Page 10: Introdução ao Windows Presentation Foundation (WPF)

Do ControlLayout e dos controlos de WPF no

Visual Studio 2008

Page 11: Introdução ao Windows Presentation Foundation (WPF)

Interface com o utilizador• WPFToolkit

DataGrid Calendar DatePicker

Page 12: Introdução ao Windows Presentation Foundation (WPF)

Interface com o utilizador• WPF Ribbon

- RibbonWindow - RibbonControl

Page 13: Introdução ao Windows Presentation Foundation (WPF)

Do WPFToolkit e WPF Ribbon numa aplicação

Page 14: Introdução ao Windows Presentation Foundation (WPF)

Resources• ResourceDictionary

<ResourceDictionary>xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> <system:String x:Key="buttonText">

Hello World!</system:String>

</ResourceDictionary>

Page 15: Introdução ao Windows Presentation Foundation (WPF)

Resources• MergedDictionaries

<ResourceDictionary><ResourceDictionary.MergedDictionaries>

<ResourceDictionarySource="MyResourceDictionary1.xaml"/>

<ResourceDictionarySource="MyResourceDictionary2.xaml"/>

</ResourceDictionary.MergedDictionaries></ResourceDictionary>

Page 16: Introdução ao Windows Presentation Foundation (WPF)

Styles<Window.Resources>

<Style x:Key="ButtonStyle"><Setter Property="Control.Background" Value="BlueViolet" /><Setter Property="Control.Foreground" Value="White" /><Setter Property="Control.FontSize" Value="20" /><Setter Property="Control.Width" Value="50" /><Setter Property="Control.Height" Value="30" />

</Style></Window.Resources>...

<Button Width="100" Style="{StaticResource ButtonStyle}">

Page 17: Introdução ao Windows Presentation Foundation (WPF)

Da criação de resources e styles

Page 18: Introdução ao Windows Presentation Foundation (WPF)

WindowsClient.net

WindowsClient

http://windowsclient.net

Page 19: Introdução ao Windows Presentation Foundation (WPF)

Livros

Page 20: Introdução ao Windows Presentation Foundation (WPF)

Dúvidas?

Page 21: Introdução ao Windows Presentation Foundation (WPF)

ReferênciasIntroduction to Windows Presentation Foundation (MSDN)

http://msdn.microsoft.com/en-us/library/aa970268.aspx

XAML Overviewhttp://msdn.microsoft.com/en-us/library/ms752059.aspx

WPF - Codeplexhttp://wpf.codeplex.com/

WPF Tutorialhttp://www.wpftutorial.net/Home.html

Foundation Blend 2 : Building Applications in WPF and Silverlighthttp://www.windowspresentationfoundation.com/

XAMLPThttp://xamlpt.com/

Page 22: Introdução ao Windows Presentation Foundation (WPF)

Propostas de Apresentações de WPF

• Manipulação de Dados:– Binding, MultiBinding, IValueConverter, ValidationRule– ObservableCollection, INotifyPropertyChanged– ICollectionView e Group, Sort, Filter dados

• Styles e Animações– Definindo Styles– Trigger, Multi-trigger, EventTrigger, Data Trigger– Control Template, Data Template, Template– Storyboard– Tipos de Animações

• Outras? ...

Page 24: Introdução ao Windows Presentation Foundation (WPF)

Obrigado!

Sara [email protected]

http://twitter.com/saramgsilva

http://pt.linkedin.com/in/saramgsilva