IntroduçãO ao Windows Presentation Foundation (WPF)


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • WPF provides a very rich and highly integrated UI stack, exposed through a .NET programming model. Figure 1 illustrates the overall architecture and the key components of WPF.ARCHITECTURE: This diagram shows the basic architecture for WPF. Notice all the different media types (in yellow) that are handled by WPF: Vectors, Bitmaps, 3D, Audio and Video, Text and Effects! Second, notice how the animation capabilities of WPF spans across all the media types, allowing you to animate any kind of content. The WPF Composition Engine (in black) is one of the revolutionary features of WPF. This engine provides capability of having live content inside of another content. This means that you can have a 3D object rotating inside a Button control and furthermore you can have a video projected over the surface of the 3D object! This tree structure and nesting capability is available for all content and every control that WPF provides. WPF is not only about rich user interfaces but also about high fidelity information, connection and data. Controls, Layout and Databinding are just some of the examples of this power. The XPS format is a rich document definition that allows us to enjoy the best of WPF in a document. In summary, WPF represents an evolution in terms of richness, interactivity as well as information and data.Link:
  • WPF is structured by using subsystems or classes that are defined in different namespaces. These classes have a very deep inheritance hierarchy. Figure: shows these important classes and their relationships.The following list describes the classes that make up the WPF subsystems (links lead to documentation on the MSDN Web site for the individual class):Object. The base class for all .NET Framework classes. DispatcherObject. The base class that handles messages from other objects.DependencyObject (DO). The base class for any object that can support dependency properties (DPs). This class defines the GetValue and SetValue methods that are central to the operation of DPs.Freezable. The base class for objects that have a modifiable state and can be “frozen” into a read-only state for performance purposes.Visual. The base class for all objects that have their own visual representation. This class provides a tree of visual objects, each optionally containing drawing instructions and metadata about how to render those instructions, such as clipping, transformation, and so on. Visual is the entry point to the WPF composition system. It is also the point of connection between two subsystems, the managed API and the unmanaged milcore (the core of the WPF rendering system).UIElement. The base class for all visual objects, which provides support for layout, input, focus, and routed events (collectively referred to as LIFE).ContentElement. A base class that is similar to UIElement, but for content that does not have its own rendering behavior. In order to be rendered in the UI, ContentElement objects must be hosted in an object that derives from Visual.FrameworkElement. A base class that adds support for styles, data binding, resources, and a few common mechanisms for Windows-based controls such as tooltips and shortcut menus.Control. The base class that provides basic elements for GUI development, such as Button, ListBox, and so on. The controls separate the data model (properties), interaction model (commands and events), and display model (templates), which enables developers to completely replace their visual aspect.Shape. The base class for shape elements, such as Ellipse, Polygon, and Rectangle.Panel. base class for all Panel elements, which is used to position and arrange child objects in WPF applications. ContentControl. The base class for controls that can have only one child element. This child element can be anything from a string to a layout panel with a combination of other controls and shapes.ItemsControl. The base class for controls that can be used to present a collection of items, such as the ListBox and TreeView controls.Link:
  • XAML simplifies creating a UI for the .NET Framework programming model. You can create visible UI elements in the declarative XAML markup, and then separate the UI definition from the run-time logic by using code-behind files, joined to the markup through partial class definitions. The ability to mix code with markup in XAML is important because XML by itself is declarative, and does not really suggest a model for flow control. An XML based declarative language is very intuitive for creating interfaces ranging from prototype to production, especially for people with a background in web design and technologies. Unlike most other markup languages, XAML directly represents the instantiation of managed objects. This general design principle enables simplified code and debugging access for objects that are created in XAML.XAML files are XML files that generally have the .xaml extension.The following XAML example shows how little markup is necessary to create a button as part of a UI. The created button has default visual presentation through theme styles, and default behaviors through its class design.Link:
  • IntroduçãO ao Windows Presentation Foundation (WPF)

    1. 1.<br />6ª Reunião Presencial – 23/01/2010<br />Introdução ao Windows Presentation Foundation (WPF)Sara Silva<br />
    2. 2. Sara Silva<br />3 anos de experiência profissional em TI<br />Lic. Matemática: EspecializaçãoemComputação - DMUC<br />MCPD: Windows Developer 3.5<br />MCTS: WPF 3.5 e Windows Forms 3.5<br />
    3. 3. Agenda<br />Introdução ao WPF<br />Tipos de Aplicações<br />Interface com o Utilizador<br /> - Layout e Controlos<br /> - WPFToolkit e WPF Ribbon<br />Resources<br />Styles<br />
    4. 4. Introdução ao WPF<br />Arquitectura<br />
    5. 5. Introdução ao WPF<br />Classes<br />
    6. 6. Introdução ao WPF<br />XAML<br />C#<br />VB.NET<br />&lt;Button Width=&quot;100&quot;&gt; OK<br /> &lt;Button.Background&gt;<br />LightBlue<br /> &lt;/Button.Background&gt;<br />&lt;/Button&gt;<br />Button b1 = new Button();<br />b1.Content = &quot;OK&quot;;<br />b1.Background = new SolidColorBrush(Colors.LightBlue);<br />b1.Width = 100;<br />Dim b1 As New Button<br />b1.Content = &quot;OK&quot;<br />b1.Background = New _SolidColorBrush(Colors.LightBlue)<br />b1.Width = 100<br />XAML = Extensible Application Markup Language<br />
    7. 7. Tipos de Aplicações<br />
    8. 8. Dos tipos de aplicações no Visual Studio 2008<br />demonstração<br />
    9. 9. Interface com o utilizador<br />ControlLayout<br />Grid<br />Canvas<br />DockPanel<br />StackPanel<br />WrapPanel<br />
    10. 10. Do ControlLayout e dos controlos de WPF no Visual Studio 2008 <br />demonstração<br />
    11. 11. Interface com o utilizador<br />WPFToolkit<br /> DataGrid Calendar DatePicker<br />
    12. 12. Interface com o utilizador<br />WPF Ribbon<br />- RibbonWindow - RibbonControl<br />
    13. 13. Do WPFToolkit e WPF Ribbon numaaplicação<br />demonstração<br />
    14. 14. Resources<br />ResourceDictionary<br />&lt;ResourceDictionary&gt;<br />xmlns=&quot; sentation&quot; xmlns:x=&quot;; xmlns:system=&quot;clr-namespace:System;assembly=mscorlib&quot;&gt; &lt;system:Stringx:Key=&quot;buttonText&quot;&gt;<br /> Hello World!<br />&lt;/system:String&gt; <br />&lt;/ResourceDictionary&gt;<br />
    15. 15. Resources<br />MergedDictionaries<br />&lt;ResourceDictionary&gt;<br />&lt;ResourceDictionary.MergedDictionaries&gt;<br />&lt;ResourceDictionarySource=&quot;MyResourceDictionary1.xaml&quot;/&gt; <br /> &lt;ResourceDictionarySource=&quot;MyResourceDictionary2.xaml&quot;/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt;<br />&lt;/ResourceDictionary&gt;<br />
    16. 16. Styles<br />&lt;Window.Resources&gt;<br />&lt;Stylex:Key=&quot;ButtonStyle&quot;&gt;<br />&lt;SetterProperty=&quot;Control.Background&quot; Value=&quot;BlueViolet&quot; /&gt;<br />&lt;SetterProperty=&quot;Control.Foreground&quot; Value=&quot;White&quot; /&gt;<br />&lt;SetterProperty=&quot;Control.FontSize&quot;Value=&quot;20&quot; /&gt;<br />&lt;SetterProperty=&quot;Control.Width&quot; Value=&quot;50&quot; /&gt;<br />&lt;SetterProperty=&quot;Control.Height&quot; Value=&quot;30&quot; /&gt;<br />&lt;/Style&gt;<br />&lt;/Window.Resources&gt;<br />...<br />&lt;ButtonWidth=&quot;100&quot; Style=&quot;{StaticResourceButtonStyle}&quot;&gt;<br />
    17. 17. Dacriação de resources e styles <br />demonstração<br />
    18. 18.<br />WindowsClient<br /><br />
    19. 19. Livros<br />
    20. 20. Dúvidas?<br />
    21. 21. Referências<br />Introduction to Windows Presentation Foundation (MSDN)<br /><br />XAML Overview<br /><br />WPF - Codeplex<br /><br />WPF Tutorial<br /><br />Foundation Blend 2 : Building Applications in WPF and Silverlight<br /><br />XAMLPT<br /><br />
    22. 22. Propostas de Apresentações de WPF<br />Manipulação de Dados:<br />Binding,MultiBinding, IValueConverter, ValidationRule<br />ObservableCollection, INotifyPropertyChanged<br />ICollectionView e Group, Sort, Filter dados<br />Styles e Animações<br />Definindo Styles<br />Trigger, Multi-trigger, EventTrigger, Data Trigger<br />Control Template, Data Template, Template<br />Storyboard<br />Tipos de Animações <br />Outras? ...<br />
    23. 23. Patrocinadores desta reunião<br />
    24. 24. Obrigado!<br />Sara Silva<br /><br /><br /><br />