Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.

Slides:



Advertisements
Similar presentations
Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands.
Advertisements

Panels, Tab Containers Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
Introduction to Windows Presentation Foundation (WPF) Dr. Frank McCown COMP 445 – GUI Programming.
WPF Layer Cake C#, C++/CLI and C
Dinko Jakovljević Microsoft Student Partner | BambooLab
An Introduction To Silverlight Gergely Orosz
Windows Presetation Foundation (WPF) 1. Introduction.
1 Moderne GUI og Silverlight Windows Presentation Foundation.
WinFX – A Lap Around the Windows Presentation Foundation Bart J.F. De Smet MVP Visual C#
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Windows Presentation Foundation: The Next GDI? Shawn Wildermuth MVP, MCSD.NET, MCT, Author and Speaker Shawn Wildermuth MVP, MCSD.NET, MCT, Author and.
1 COS240 O-O Languages AUBG, COS dept Lecture 33 Building Apps Technologies C# (WPF part 1)
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Web Technologies Website Development Trade & Industrial Education
Target: dependency property Source: any public property CLR and WPF properties Target: dependency property Source: any public property CLR and WPF properties.
Module 11 Control Customization. Module Overview Overview of Control Authoring Creating Controls Managing Control Appearance by Using Visual States Integrating.
1 Intro XAML Attribute syntax & property syntax Panels Reusable resources Controls Data binding Steen Jensen, spring 2014.
V 1.1 Programming III. GUI APIs WPF Hello World Important UI elements UI elements / content models UI elements / inheritance.
An Introduction to Silverlight Matt Harrington Developer Evangelist, Microsoft October 20, 2011.
Windows Presentation Foundation. Agenda Introduction Developing Applications WPF and WF interoperability Custom Controls Styles and Templates Data Binding.
Website Development with Dreamweaver
V 1.0 Programming III. Comparison of GUI APIs WPF Hello World UI elements Content models Inheritance chains.
C# Events and WPF #W5. Horizontal Prototype WPF Designed for rapid user interface design Used for many devices: Windows Phone, Tablets, PCs,
Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC
Applets and Frames CS 21a: Introduction to Computing I First Semester,
John Daintree Chief Architect Dyalog Windows Presentation Foundation.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
V 1.0 Programming III. Automatic notifications (…Changed, INofityPropertyChanged, ObservableCollection ) Data formatters Data conversions Resources.
LAYOUT CONTROLS. XAML Overview XAML : eXtensible Application Markup Language pronounced (ZAMEL) is a markup language used to design user interfaces XML-based.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
Graphical User Interfaces Tonga Institute of Higher Education.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
John Daintree Data Binding Reloaded. Data Binding (2013) Data Binding Reloaded (2014) Data Binding Revolutions (2015) The Databinding Trilogy.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Svetlin Nakov Telerik Corporation
Introducing Windows Presentation Foundation (Avalon) The Next GDI? Shawn Wildermuth Wildermuth Consulting Services, LLC
A Lap Around Windows Presentation Foundation. Why hasn’t UX taken off in software? It’s Difficult! Animation 2D 3D Documents Styled Controls Video Windows.
Windows Presentation Foundation (WPF). Introduction Separates appearance of user interface from behavior Appearance usually specified by XAML Behavior.
C# kursus Rohde & Schwarz1 Moderne GUI Windows Presentation Foundation.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Workflow Foundation Ruwan Wijesinghe.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
ControlTemplate and DataTemplate Doncho Minkov Telerik School Academy Technical Trainer
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
.NET Framework Presentation. About Me Patrik Löwendahl –C# MVP –Certified Vista Touchdown Trainer Cornerstone
V 1.0 Programming III. Automatic notifications with data binding (…Changed, INofityPropertyChanged, ObservableCollection, DataTemplate) Data formatters.
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
V 1.0 Programming III. XAML Data Binding I.. V 1.0ÓE-NIK, 2014 XAML namespaces Namespaces define the allowed tags and attributes The one without the prefix.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.
REC [ ] How to implement CAMERA RECORDING for USB WEBCAM or IP CAMERA in C#.NET SOURCE CODE: ! Welcome to this presentation that explains.
Soyatec Contents Needs Architecture XAML fundamentals Data Binding Advanced features Style Q&A.
WPF (Avalon), Windows App GUI Windows App GUI Web App GUI Web App GUI HTML HTML XML XML WPF WPF LINQ LINQ.
Part of the Microsoft.NET Framework 3.0 Tomer Shamam.NET Technologies Expert Sela Group
Introduction to Silverlight Development Pavel Yosifovich CTO, Matrix Global; Senior Instructor, Hi-Tech College
Dive Into® Visual Basic 2010 Express
Introduction to Silverlight
Windows Presentation Foundation
Leading edge windows development
Ben Riga 02 | Basics of View Models Ben Riga
Introduction to Silverlight
XAML User Interface Creation in C#
.NET and .NET Core: Languages, Cloud, Mobile and AI
WPF AKEEL AHMED.
Windows Presentation Foundation
Resources & Controls AKEEL AHMED.
ASP.NET.
ListView and GridView (2)
Presentation transcript:

Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe

2 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Introduction Windows Presentation Foundation uses XAML, a declarative markup language WPF applications can be Completely developed using XAML Completely developed using Code Can be a mix of that (can separate presentation and presentation control logic, XAML for presentation and code for logic) Provides a uniform programming model for 2D and 3D graphics Multimedia Documents Provides resolution independent graphics Based on managed code

3 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Architecture Managed Unmanaged

4 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Application Types Windows Applications Similar to Windows Forms Application. Run is a separate window Navigation Application Similar to web applications. Page based. Can navigate back and forth. Browser Based Navigation Executed in Browser. Can used to develop internet and intranet based applications. Needs WinFX or WPF/E (Windows Presentation Foundation Everywhere) installed in client machine. Navigation Windows based Navigation Executed in a Navigation windows. Used for installed applications

5 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Hello World from XAML < Window x:Class =“ HelloApplication.Window1 " xmlns =" " xmlns:x =" " Title =" Hello Window " Height =“ 200 " Width =" 300 “ > Hello World

6 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Layout Layout controls are used in XAML to place the controls in desired positions Position and the size of the controls, when window is being resized is determined by the layout being used The following layout control are widely used in XAML Grid Canvas DockPanel StackPanel

7 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Using StackPanel Layout < Window x:Class =“ HelloApplication.Window1 " xmlns =" " xmlns:x =" " Title =" Hello Window " Height =“ 200 " Width =" 300 “ > Hello World Click Here

8 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Using StackPanel Layout 2 <Window x:Class="WindowsApplication1.Window1" xmlns=" xmlns:x=" Title="WindowsApplication12" Height=“200" Width="300“ > Hello World Click Here

9 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Using Grid Layout 1 <Window x:Class="WindowsApplication1.Window1" xmlns=" xmlns:x=" Title="WindowsApplication12" Height="160" Width="300" > Hello World Click Here

10 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Using Grid Layout 2 Hello World Button 1

11 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Using Dock Panel My Heading Here <TextBlock Background="Beige" DockPanel.Dock="Left" Width="60px" TextWrapping="Wrap"> Some Text to be in the left panel of the window Hello World Button 1

12 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Events <Window x:Class="WindowsApplication1.Window1" xmlns=" xmlns:x=" Title="WindowsApplication12" Height="154" Width="320" > <TextBlock Height="20" Margin="131,24,58,0" Name="textBlock1" VerticalAlignment="Top"> Some Text <Button Height="23" Margin="105,0,109,34" Name="button1" VerticalAlignment="Bottom" Click="Button1_Click"> Button

13 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Events – Code Behind namespace WindowsApplication12 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } void Button1_Click (object sender, EventArgs e) { textBlock1.Text = "Hello World"; }

14 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Navigation Application – Hello World <Page x:Class="WindowsApplication1.Page1" xmlns=" xmlns:x=" Title="Page1" > <TextBlock Margin="60,80,80,0" Height="35" VerticalAlignment="Top" FontSize="30"> Hello World

15 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Navigations <Page x:Class="WindowsApplication1.Page1" xmlns=" xmlns:x=" Title="Page1" > Go to: Page1 <Button Margin="100,150,0,0" Height="20" Width=“100" Name="button1" Click="Navigate_Click" HorizontalAlignment="Left“ VerticalAlignment="Top"> Go to Page 2 void Navigate_Click(object sender, EventArgs e) { this.NavigationService.Navigate(new Uri("Page2.xaml", UriKind.Relative)); }

16 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Navigation in a Frame <Page x:Class="WindowsApplication1.Page1" xmlns=" xmlns:x=" Title="Page1" > <Button Margin="100,40,120,0" Height="25" Name="button1" Click="Navigate_Click" VerticalAlignment="Top" Width="80">Button <Frame BorderBrush="#FF000000" BorderThickness="1,1,1,1" Margin="30,90,30,30" Name="frame1" FixedPage.NavigateUri="Page.xaml" /> void Navigate_Click(object sender, EventArgs e) { frame1.Navigate (new Uri("Page2.xaml", UriKind.Relative)); }

17 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Text Layout <TextBlock Margin="33,23,0,80" TextWrapping="Wrap" TextAlignment="Justify" HorizontalAlignment="Left" Width=" "> Page 2 Click back arrow in the navigation window or click on this link to go back to the previous window

18 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Control Templates <Button Margin="50,50,0,0" Width="100" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top"> <TextBlock Name="ButtonText" Foreground ="Yellow" VerticalAlignment="Center" HorizontalAlignment="Center" > Button 1

19 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Control Templates as Resources <TextBlock Name="ButtonText" VerticalAlignment="Center" HorizontalAlignment ="Center" Foreground ="Yellow"> Button 1 <Button Template="{StaticResource MyBtnTemplate}" Margin="50,50,0,0" Width="100" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top">

20 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Data Binding <Label Height="20" HorizontalAlignment="Left" Margin=“50,10,0,0" Name="label1" VerticalAlignment="Top" Width="130" Content="{Binding Path=Name}" /> <TextBox Margin=“50,50,120,70" Name="textBox1“ Text="{Binding Path=Prop1}" /> public Window1() { InitializeComponent(); MyItem1 item = new MyItem1(1,"Ruwan","AAA"); this.DataContext = item; }

21 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL using System.Collections.ObjectModel; namespace WindowsApplication1 { class MyItemCollection: ObservableCollection { public MyItemCollection() { this.Add(new MyItem1(1,"Ruwan","AAA")); this.Add(new MyItem1(2,"Saman","BBB")); this.Add(new MyItem1(3,"Vimal","CCC")); }

22 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Data Binding to Collections : public Window1() { InitializeComponent(); ObservableCollection items = new ObservableCollection (); items.Add(new MyItem1(1,"Ruwan","AAA")); items.Add(new MyItem1(2,"Saman","BBB")); items.Add(new MyItem1(3,"Vimal","CCC")); this.DataContext = items; }

23 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Declarative Data Binding <Window x:Class="WindowsApplication14.Window1" xmlns=" xmlns:x=" xmlns:my="clr-namespace:WindowsApplication1" Title="WindowsApplication14" Height=“400" Width="450" > <ListBox ItemsSource="{Binding Source={StaticResource MyCollection}}" Width="120" Height="50"> This code adds the values return by ToString() method of the items in MyItemCollection to the ListBox

24 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Declarative Data Binding using Data Templates : <ListBox ItemsSource="{Binding Source={StaticResource MyCollection}}" Width="120" Height="50">

25 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Built-in Command

26 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Custom Commands <CommandBinding Command="{x:Static my:Window1.CustCommand}" Executed=“CustCmdExecuted" CanExecute=“CustCmdCanExecute" /> public static RoutedCommand CustCommand = new RoutedCommand(); void CustCmdExecuted(object target, ExecutedRoutedEventArgs e) { MessageBox.Show(“My custom command has been invoked."); } void CustCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; }

27 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Hot-Keys <KeyBinding Command="{x:Static my:Window1.CustCommand}" Modifiers="Control" Key="R" CommandParameter="InputGesture"/> <CommandBinding Command="{x:Static my:Window1.CustCommand}" Executed=“CustCmdExecuted" CanExecute=“CustCmdCanExecute" /> public static RoutedCommand CustCommand = new RoutedCommand(); void CustCmdExecuted(object target, ExecutedRoutedEventArgs e) { MessageBox.Show(“My custom command has been invoked."); } void CustCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; }

28 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Animations <DoubleAnimation Storyboard.TargetName="MyRectangle" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever" />

29 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Styles Button 1

30 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Named Styles <Button Style="{StaticResource Style2}" Width="75" Height="30" Margin="100,50,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">Button 1 Button 1

31 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Triggers <Button Style="{StaticResource Triggers}" Width="75" Height="30" Margin="100,50,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">Button 1

32 Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Data Triggers <ListBox ItemsSource="{Binding Source={StaticResource MyCollection}}" Width="120" Height="50">