windows presentation foundation
DESCRIPTION
WPF for beginningTRANSCRIPT
![Page 1: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/1.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
What's New in WPF Version 4.5?
![Page 2: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/2.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Windows Presentation Foundation1
Benefits2
Tools3
Discussion of WPF applicability4
![Page 3: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/3.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
What is WPF? WPF is a new API for building Windows applications
The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version 4.0 of the Microsoft .NET Framework, WPF allows building interfaces that incorporate documents, media, two- and three-dimensional graphics, animations, Web-like characteristics, and much more.
![Page 4: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/4.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
What Windows Presentation Foundation Provides?
Three most important: a unified platform for modern user interfaces the ability for developers and designers to
work together, and a common technology for Windows and
Web browser user interfaces.
![Page 5: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/5.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
What is WPF good for?To enable designers and developers to work
together To allow an easy way to customize the look
of controls without changing its behavior To allow 3D graphics more easily in
Windows applications To allow an easy way to do animations in
Windows applications To enable the creation of applications which
scale nicely to high resolution screens
![Page 6: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/6.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Which of these UI have you worked with?
GDI (20 years), GDI+, WinForms DirectX (11 years), Direct3D Quartz, DirectShow (8 years) – Problems:
• Showing their age • Each API is different • Mixing APIs is challenging
![Page 7: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/7.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Next Gen
WPF – replaces GDI Direct3D – large games, used by WPF Media Foundation – ultimately will replace
DirectShow MCML –markup language for Media
Center Edition applications XNA – small games
![Page 8: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/8.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
WPFDeclarative programming with XAML markup For Designers and Developers Rewritten from scratch
– Built on top of Direct3D – Hardware accelerated – Vector based – Resolution independent (1/96 inch) – Retained graphics
![Page 9: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/9.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Overview of WPF Architecture
Most of WPF is written in managed code
milcore is the only unmanaged component of WPF
![Page 10: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/10.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
XAML: Extensible Application Markup Language Declarative object instantiation Not exclusive to WPF Separates UI and logic
– Common language for Designers and Developers • Demo: Blend and VS
– Parallel development – Localization, Branding – Targeted UI (devices, users, …)
Tool support Supports C# and VB.NET
![Page 11: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/11.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Benefits
Markup/code-behind model (like ASP.NET) Excellent layout options and text flow features Access to powerful graphics hardware Certain otherwise-impossible effects are
made easy (skewing and rotating textboxes, etc.)
![Page 12: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/12.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Tools• Cider • XAML Pad • 3D tools such as Light wave can generate XAML. – Electric Rain Zam 3D – Mobiform Aurora – Cinema 4D • Microsoft Expression – Graphics Designer – Interactive Designer
![Page 13: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/13.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Comparisons: WPF vs. DirectX and GDI+
![Page 14: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/14.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
WPF Build Pipeline
![Page 15: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/15.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Basic topics in WPF
WPF code and XAML Property & object in XAML: syntax Layout Basic control Basic property WPF Concepts
![Page 16: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/16.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
1. WPF code and XAML: first appWPF code – New consoles project (or Windows Apps) – Reference: PresentationCore, PresentationFramework, and WindowsBase
How to create this window?
![Page 17: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/17.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRYusing System.Windows;using System.Windows.Controls;namespace StudyWPFApplication{ public class Class1 { [STAThread]//Must insert before Main public static void Main(string[] aargs){ Window w = new Window(); Button btn = new Button(); btn.Width = btn.Height = 100; btn.Content = "Click Me!"; w.Content = btn; w.Title = "Khoa Công Nghệ Thông Tin"; Application A = new Application(); A.Run(w);} }}
![Page 18: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/18.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
1. WPF code and XAML: first app From VS template
App is inherited from Application
Window1 is inherited from Window
![Page 19: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/19.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
![Page 20: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/20.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY1. WPF code and XAML: first app From VS template Write 2 example: code and Xaml
![Page 21: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/21.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY1. WPF code and XAML: first app From VS template Write 2 example: code and Xaml
![Page 22: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/22.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2. Basic Window properties
Title WindowStyle Content Foreground Background
Brush
SolidColorBrush GradientBrush TileBrush
LinearGradientBrush RadialGradientBrush
![Page 23: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/23.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
![Page 24: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/24.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
using System.Windows.MediaSolidColorBrush
Color cr = new Color();cr.B = cr.R = cr.G = 122;cr.A = 255;
SolidColorBrush br = new SolidColorBrush(cr);button1.Background = br;
![Page 25: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/25.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
SolidColorBrush
SolidColorBrush brush=new SolidColorBrush(Colors.Red);rect1.Fill = brush;
XAML CODE
![Page 26: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/26.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
SolidColorBrush
XAML
![Page 27: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/27.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
GradientBrush
![Page 28: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/28.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
LinearGradientBrushPoint p1 = new Point(0, 0); Point p2 = new Point(1, 1); LinearGradientBrush br = new LinearGradientBrush (Colors.Red,Colors.White, p1, p2);rect1.Fill = br;
![Page 29: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/29.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
LinearGradientBrushLinearGradientBrush br = new
LinearGradientBrush();br.GradientStops.Add(
new GradientStop(Colors.Yellow, 0.0));br.GradientStops.Add(
new GradientStop(Colors.Orange, 0.5));br.GradientStops.Add(
new GradientStop(Colors.Red, 1.0));rect1.Fill = br;
![Page 30: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/30.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
LinearGradientBrush
XAML
![Page 31: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/31.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
RadialGradientBrush
RadialGradientBrush br = newRadialGradientBrush(Colors.Blue,Colors.White);
![Page 32: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/32.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
RadialGradientBrush
RadialGradientBrush br = new RadialGradientBrush(Colors.Blue,Colors.Yellow);rect1.Fill = br;
![Page 33: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/33.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
RadialGradientBrush br = new RadialGradientBrush();br.GradientOrigin = new Point(0.75, 0.25);br.GradientStops.Add(
new GradientStop(Colors.Yellow, 0.0));br.GradientStops.Add(
new GradientStop(Colors.Orange, 0.5));br.GradientStops.Add(
new GradientStop(Colors.Blue, 1.0));rect1.Fill = br;
RadialGradientBrush
![Page 34: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/34.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
XAML
RadialGradientBrush
![Page 35: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/35.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
ImageBrush myBrush = new ImageBrush();myBrush.ImageSource =new BitmapImage( new Uri(@"E:\Pictures\IC151762.jpg", UriKind.Relative));rect1.Fill = myBrush;
ImageBrush
![Page 36: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/36.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Config Brush from VS design
![Page 37: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/37.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2. Handling Application Events
From Code
![Page 38: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/38.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2. Handling Application Events
From XAML
![Page 39: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/39.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2.Code-Behind and Object Names
<Button Name="myButton">Hello</Button>
Classes have a Name property
Classes don’t have a Name property
<Button x:Name="myButton">Hello</Button>
![Page 40: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/40.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2. Logical Trees and Visual TreesLogical tree comprises the elements
as they are listed in the XAML. These include panels and controls you will generally use.
Visual tree includes the parts that make up the controls and panels.
![Page 41: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/41.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
![Page 42: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/42.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
2.Top-Level Elements
Three classes are used by WPF programs as top-level elements
– Application – Page – Window
• Only one Content
![Page 43: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/43.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for Object
One element
Empty element tag
![Page 44: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/44.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for ObjectNested- Multi elements
Logical tree with four WFP objects
XAML Tree With Four Elements
![Page 45: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/45.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for Attribute
Object element syntax – Like object syntax • <button> FIT HUI </button>
Attribute syntax Property Element Syntax Attached Property Syntax
![Page 46: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/46.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for Attribute
![Page 47: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/47.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for Attribute
Property Element Syntax – Some properties are too complex to be set with a simple string – Does not produce an object, sets a property on an object
![Page 48: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/48.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<Button > <Button.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <GradientStop Color="Red" Offset="0.0"/> <GradientStop Color="Blue" Offset="1.0"/> </LinearGradientBrush> </Button.Background> Click me</Button>
3. Syntax for AttributeProperty Element Syntax
![Page 49: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/49.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for AttributeAttached Property Syntax – Attached properties are a special type of property that is defined in one class but used in another.
![Page 50: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/50.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
3. Syntax for AttributeReviewing the XAML Syntax
![Page 51: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/51.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY<Window> <StackPanel > <StackPanel.Background> <RadialGradientBrush> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="#FF56933A" Offset="1" /> <GradientStop Color="#FF2B2B2B" Offset="0.169" /> </RadialGradientBrush> </StackPanel.Background> <Grid Height="141" Name="grid1" Width="260"> <Grid.RowDefinitions> <RowDefinition Height="61*" /> <RowDefinition Height="80*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="118*" /> <ColumnDefinition Width="142*" /> </Grid.ColumnDefinitions> <TextBlock Grid.RowSpan="2" Height="23" /> <Button Content="Button" Grid.Row="1"> <Button.BorderBrush> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="#FFB44E4E" Offset="1" /> </LinearGradientBrush> </Button.BorderBrush> </Button> <CheckBox Content="CheckBox" Grid.Column="1" Grid.Row="1" /> </Grid> </StackPanel></Window>
4. Example
![Page 52: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/52.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
5. XAML NamespaceTo create objects of these types, the XAML
parser must know where to find their definitions
![Page 53: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/53.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
5. XAML Namespace
![Page 54: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/54.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
5. XAML Namespace: Classes from Other Namespaces
![Page 55: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/55.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
using System;using System.Windows;using System.Windows.Controls;using System.Windows.Media;namespace StudyWPFApplication{ public class MyButton:Button{ public MyButton(){ Background = new LinearGradientBrush( Colors.Yellow,Colors.Blue,
new Point(0,0),new Point(1,1)); } }}
Create MyButton extend from class Button
![Page 56: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/56.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
xmlns:local="clr-namespace:StudyWPFApplication"
Declare prefix:
In XAML
<local:MyButton Content="Hello" ></local:MyButton>
Instantiate the button:
![Page 57: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/57.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
5. Markup Extensionhook to a class outside the XAML class designed to be used by a markup extension is
called an extension class xmlns:local="clr-namespace:StudyWPFApplication"
using System;using System.Windows.Markup;namespace StudyWPFApplication{public class MyMarkupExtension:MarkupExtension{public MyMarkupExtension() { }public override object ProvideValue
(IServiceProvider serviceProvider) { return DateTime.Now.ToShortDateString(); } }}
<TextBox Name="txt" Text="{local:MyMarkupExtension}"/>
![Page 58: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/58.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout: Layout in WPFBefore WPF, user interfaces generally
consisted of windows with statically placed controls.
WPF: layout systemconsist of one or more panels that contain
visual elements
![Page 59: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/59.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Layout in Windows From Control have fix coordinates: X,Y Dock, Anchor Using FlowLayoutPanel to arrange
controls in a flow panel Using TableLaoutPanel to arrange
controls in table format
6. Layout Basic Principle
![Page 60: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/60.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout Basic Principle
XAML Layout Flow-based layout
• Support coordinate Contain is organizaed into containers Resolution and size independent interfaces Automatically adjust if screen resolution
changes
![Page 61: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/61.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout in WPFLayout in WPF
Alignment Padding and Margins
Containers (Panels) StackPanel WrapPanel DockPanel Grid Canvas UniformGrid
![Page 62: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/62.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. XAML Layout: Align & Padding
Alignment describes how child elements should be posisioned within parent’s space HorizontalAlignment: Left, Center, Right,
or Stretch VerticalAlignment: Top, Center, Bottom, or
Stretch
![Page 63: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/63.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Margin Distance between an elenment and its
child or peers Left, top, right, bottom, or uniform
(Margin=“5”) Padding
Enlarges a child element by specified thickness
6. XAML Layout: Align & Padding
![Page 64: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/64.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. XAML Layout: Align & Padding
![Page 65: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/65.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout Panels Canvas
for specific (X,Y) positioning
![Page 66: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/66.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout Panels StackPanelArranges content either horizontally or
vertically
![Page 67: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/67.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout Panels WrapPanel
Arranges item sequentially
![Page 68: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/68.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
6. Layout Panels DockPanelAnchor elements to the edges of the
container
![Page 69: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/69.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY6. Layout Panels GridTable-style layout of rows and columns
![Page 70: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/70.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY6. Layout Panels UniformGrid
All rows and columns are the same size Contains two properties, Rows and Columns
![Page 71: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/71.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Types of ContainersBasic controls Resource Style Control template Binding Graphic element
![Page 72: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/72.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Types of Containers
![Page 73: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/73.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY Types of Containers : ExampleSingle item
Collection items
Single item and Collection items
<Button>Click me</Button>
<ListBox> <ListBoxItem>a</ListBoxItem> <ListBoxItem>b</ListBoxItem>
<TextBox>FIT HUI</TextBox> <Button>Click me</Button></ListBox>
<ListBox > <ListBoxItem>a</ListBoxItem> <ListBoxItem>b</ListBoxItem> <ListBoxItem>c</ListBoxItem></ListBox>
![Page 74: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/74.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7. Basic controls
Simplest controls Border CheckBox Button RadioButton
More controls
![Page 75: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/75.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Border control
Container control can contains controls Without border using Border control
Accept single child control Display border around child control Property
Backgound : Brush BorderBrush BorderThickness CornerRadius
![Page 76: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/76.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<Border Margin="20,20,20,20" BorderBrush="Blue" BorderThickness="1,1,2,2" CornerRadius="20" Height="88"
Background="WhiteSmoke"> <Button Height="32" Width="76">Border</Button></Border>
7.1 Border control
How to make border???
![Page 77: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/77.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 RadioButton -CheckBox
<StackPanel> <RadioButton GroupName="Os" Content="Windows 7" IsChecked="True"/> <RadioButton GroupName="Os" Content="Windows 8" /> <RadioButton GroupName="Office" Content="Microsoft Office 2010" IsChecked="True"/> <RadioButton GroupName="Office" Content="Open Office"/></StackPanel>
RadioButton Properties GroupName IsChecked
![Page 78: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/78.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 RadioButton -CheckBox Checkbox Properties
IsChecked <Border Margin="20,20,20,20" BorderBrush="Red" BorderThickness="1,1,2,2" CornerRadius="25" Height="88" Background="Lavender"> <StackPanel> <CheckBox IsChecked="True" Content="RấRt Hài Lòng" Height="21" Width="145"></CheckBox> <CheckBox Content="Hài Lòng" Height="21" Width="145"></CheckBox> <CheckBox Content="Tạm ChấRp Nhận" Height="21" Width="145"></CheckBox> <CheckBox Content="Không ChấRp Nhận" Height="21" Width="145"></CheckBox> </StackPanel></Border>
![Page 79: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/79.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: Text, date, miscText entry controls
TextBlock, Label, Textbox, PasswordBox • View – edit text TextBlock vs Label
TextBlock: Static text, standard font properties: FontFamily, FontSize, FontStyle, FontWeight: for using simple static text
• <LineBreak/> to inject line break • Using <Run> : each run have its own formatting
<TextBlock>FIT <LineBreak/>HUI <Run Background="Blue" FontSize="20" Foreground="red"> Hello. </Run> H.a.you?</TextBlock>
![Page 80: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/80.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: Text, date, misc
How to fill background for result text???
And How to change font style when mouse down???
![Page 81: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/81.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: LabelLabel: target, underscore _, content When you want to display text by itself use
the TextBlock. The benefit is a light, performant way to display text.
When you want to associate text with another control like a TextBox use the Label control. The benefits are access keys and references to target control.
![Page 82: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/82.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: LabelLabel: target, underscore _, content <StackPanel> <Label Target="txta">Nhập _a</Label> <TextBox Name="txta"></TextBox> <Label Target="{Binding
ElementName=txtb, Mode=Default}">Nhập _b</Label>
<TextBox Name="txtb"></TextBox> </StackPanel>
![Page 83: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/83.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: Textbox controlProperties
TextWrapping AccepsReturn IsEnabled ReadOnly VerticalScrollbarVisibility,
HortizontalScrollbarVisibility SpellCheck.IsEnabled (Language)
Events – KeyDown, KeyUp, TextChanged
![Page 84: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/84.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: Textbox control Examples
<TextBox
VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Margin="0,0,0,0" SpellCheck.IsEnabled="True"AcceptsReturn="True" Text="FIT
HUI" Height="41" Width="276">
</TextBox>
![Page 85: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/85.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Basic Controls: Passwordbox
Like Textbox Property: PasswordChar No Text property, rereive Password Do not support clipboard
<PasswordBox Name="txtPassword" ToolTip="Password" PasswordChar="*" Height="30" Width="224" />
![Page 86: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/86.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Date control: Calendar controlTag <Calendar> SelectionMode: select single day, range
date.. DiplayMode: Month, Year, Decade BlackOutDates : set black out dates DisplayDateStart, DisplayDateEnd: range
of available dates
![Page 87: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/87.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Date control: Calendar control
<Calendar DisplayDateStart="2012-01-1" DisplayDateEnd="2012-1-30"> <Calendar.BlackoutDates> <CalendarDateRange Start="2012-1-5" End="2012-1-10"/> </Calendar.BlackoutDates></Calendar>
![Page 88: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/88.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Date control: DatePicker control
Allow to select a single date using dropdown calendar
IsDropDownOpen SelectedDateFormat, BlackOutDates,
DisplayDateStart, DisplayDateEnd SelectedDateChanged event
![Page 89: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/89.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Date control: DatePicker control<DatePicker DisplayDateStart="2012-1-1"
DisplayDateEnd="2012-1-31" SelectedDate="2012-1-15">
<DatePicker.BlackoutDates> <CalendarDateRange
Start="1/1/2012" End="1/5/2012" />
</DatePicker.BlackoutDates></DatePicker>
![Page 90: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/90.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous controlSlider, ProgressBar, MediaElement Slider Minimum, Maximum, Orientation, Value,
SmallChange, LargeChange, IsDerectionReversed ProgressBar Minimun, Maximun Change Value, or using IsInDeterminate property Check out
System.Windows.Threading.DispatcherTimer to run code at regular intervals • Demo
Image Source Stretch
![Page 91: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/91.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous control <StackPanel> <Slider Minimum="0" Maximum="10" Value="5"></Slider> <ProgressBar Minimum="0" Maximum="100" Name="prb" Height="20"/> <Image Source="E:\Pictures\a.jpg" Height="120.83" Stretch="Fill" Width="129.846" /> <Button Click="btn_Click" >Demo progressbar</Button> <Button Click="btn1_Click" >Demo gressbar – IsInDetermine</Button></StackPanel>
XAML
![Page 92: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/92.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous control
System.Windows.Threading.DispatcherTimer timer;private void btn_Click(object sender, RoutedEventArgs e) { timer=new System.Windows.Threading.DispatcherTimer(); timer.Tick += new EventHandler(my_tick); timer.Interval = new TimeSpan(0, 0, 1); timer.Start(); }public void my_tick(object sender, EventArgs e) { if (prb.Value >= prb.Maximum) timer.Stop(); prb.Value += 1;} Example code 1
![Page 93: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/93.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous control
Example code 2
private void btn_Click(object sender, RoutedEventArgs e)
{System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();timer.Tick += delegate { if (prb.Value >= prb.Maximum) timer.Stop(); prb.Value += 10; };timer.Interval = new TimeSpan(0, 0, 1);//h,m,stimer.Start();}
![Page 94: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/94.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous controlMediaElement
Display media Souce property: URI LoadedBehavior="Manual“ for using
control methods IsMuted Position, Volume Call Play, Pause, Stop methods Invisible until playing video file
![Page 95: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/95.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<Window …> <StackPanel> <MediaElement Source="music.mp3"/> </StackPanel> </Window>
This program loads the media file and immediately starts playing it.
7.1 Miscellaneous controlMediaElement
Example 1
![Page 96: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/96.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<StackPanel> <MediaElement Name="player" LoadedBehavior="Manual" /> <StackPanel Orientation="Horizontal"
VerticalAlignment="Top"> <Button Click="Play_Click" Margin="3" Padding="6,3">Play</Button> <Button Click="Pause_Click" Margin="3" Padding="6,3">Pause</Button> <Button Click="Stop_Click" Margin="3" Padding="6,3">Stop</Button> </StackPanel></StackPanel>
7.1 Miscellaneous control
Example 2 - XAML
![Page 97: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/97.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.1 Miscellaneous control
Example 2 - Code
public partial class SampleMediaElement : Window { public SampleMediaElement() { InitializeComponent();
player.Source = new Uri(@"Hello.mp3"); }
private void Play_Click(object sender, RoutedEventArgs e) {
player.Play(); }
private void Pause_Click(object sender, RoutedEventArgs e) {
player.Pause(); }
private void Stop_Click(object sender, RoutedEventArgs e) {
player.Stop(); } }
![Page 98: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/98.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.2 List controls Listbox/Combobox Are container elements: <ListBoxItem> SelectedIndex SelectedItem (return element type) SelectionChanged event (Listbox) SelectionMode: single,
expand… Can contains others control: textbox,
image…
![Page 99: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/99.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.2 List controls Example <ListBox Name="lst" Width="374"> <ListBoxItem>a</ListBoxItem> <ListBoxItem>b</ListBoxItem> <ListBoxItem>c</ListBoxItem> <TextBox>Hello</TextBox> <Button>Button here</Button> <StackPanel Orientation="Horizontal"> <Image Width="71" Height="84"
Source="E:\a.jpg" Stretch="Fill"> </Image> <Label Background="Wheat">Hình nè</Label> </StackPanel></ListBox>
![Page 100: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/100.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.3 TreeView
Contains TreeViewItems TreeViewItem
– Header – Tag
SelectedItemChanged event: when select node
Can contain image, text Demo: item with text & image
![Page 101: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/101.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.3 TreeView
![Page 102: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/102.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.3 TreeView
![Page 103: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/103.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.4 Menu
Place everywhere you want Use Grid of DockPanel Set IsMainMenu = true when Top level menu MenuItem
• Container control • Header property • Icon property • Click event
![Page 104: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/104.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.4 Menu<StackPanel Margin="0" > <Menu Name="cm"> <MenuItem Header="File"> <MenuItem Header="open"/> <MenuItem Header="exit"/> <MenuItem Header="Last open"> <MenuItem Header="file1" IsCheckable="True"/> <MenuItem Header="file2" IsCheckable="True"/> </MenuItem> </MenuItem> </Menu></StackPanel>
![Page 105: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/105.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.5 Context Menu : ContextMenu property<Button>Button with Context menu <Button.ContextMenu> <ContextMenu Name="cmd"> <MenuItem Header="Copy" > <MenuItem.Icon> <Image Source="copy.png"></Image> </MenuItem.Icon> </MenuItem> <MenuItem Header="Paste" > <MenuItem.Icon> <Image Source="paste.png"></Image> </MenuItem.Icon> </MenuItem> </ContextMenu> </Button.ContextMenu></Button>
![Page 106: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/106.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.6 ScrollViewer
Contain control with both horizontal and vertical bars built-in
Use it when content may not fir a window and you want to enable scrolling (example: StackPanel)
VerticalScrollBar and HorizontalScrollBar – Auto: scroll bar auto apprear
![Page 107: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/107.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.6 ScrollViewer
![Page 108: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/108.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.6 ScrollViewer
<ScrollViewer
HorizontalScrollBarVisibility="Auto" Width="800" Height="500"> <StackPanel VerticalAlignment="Top"
HorizontalAlignment="Left" > <Image Source="baby1.jpg" /> <Image Source="bird1.jpg" /> </StackPanel></ScrollViewer>
![Page 109: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/109.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.7 TabControl and TabItemSeparate pages TabItem – Header property
<TabControl> <TabItem Header="tabpage 1"> <Button>Tab 1 nè</Button> </TabItem> <TabItem Header="tabpage 2"> <WrapPanel> <Button>Tab 2 nè</Button> <TextBlock>Thô�ng tin ở đay</TextBlock> </WrapPanel> </TabItem></TabControl>
![Page 110: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/110.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.8 GroupBoxHeader property Common: contains checkbox, radio buttons.
<GroupBox Header="Student information" BorderBrush="Red" BorderThickness="2"> <StackPanel> <WrapPanel> <TextBlock Width="90">Student ID:</TextBlock> <TextBox Width="150"></TextBox> <TextBlock Width="90">Student Name:</TextBlock> <TextBox Width="150"></TextBox> </WrapPanel> </StackPanel></GroupBox>
![Page 111: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/111.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
7.9 Expander controlHeader and collapsible content region Expanded and Collapsed events ExpandDirection property:
Down, up, left, right
<Expander Header="expander FIT HUI example"
ExpandDirection="Down"> <TabControl> <TabItem Header="tabpage1"> <Button>Hello</Button> </TabItem> </TabControl></Expander>
![Page 112: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/112.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
8. ResourcesType of resouces Assembly resources (binary resources) • compiled into the binary • Example: image, icon… • Resource—not Embedded Resource Logical resources (object resources,
XAML resources) • associated with XAML markup
![Page 113: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/113.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY<StackPanel Name="sp"> <TextBlock FontFamily="Arial Black" Margin="7">
Some Buttons</TextBlock> <Button Height="40" Name="btn1" FontWeight="Bold"> <Button.Background>← Defining the Background <LinearGradientBrush StartPoint="0, 0" EndPoint="1,1"> <GradientStop Color="White" Offset="0" /> <GradientStop Color="Blue" Offset="1"/> </LinearGradientBrush> </Button.Background> Button 1 </Button> <Button Height="40" Name="btn2" FontWeight="Bold"> <Button.Background>← Defining the Background Again <LinearGradientBrush StartPoint="0, 0" EndPoint="1,1"> <GradientStop Color="White" Offset="0" /> <GradientStop Color="Blue" Offset="1"/> </LinearGradientBrush> </Button.Background> Button 2 </Button></StackPanel>
Why ???
![Page 114: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/114.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Resources store reference to an object within a collection
most objects in the WPF framework have a Resources collection: Application, Window, Button, …
A resource can be anything: Brush, a control template …
Find resource: navigates up
8. Resources
![Page 115: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/115.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<Window …><Window.Resources> <RadialGradientBrush x:Key="btnbrush"> <RadialGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0"/> <GradientStop Color="Red" Offset="0.25"/> <GradientStop Color="Blue" Offset="0.75"/> <GradientStop Color="LimeGreen" Offset="0.8"/> <GradientStop Color="Black" Offset="1" /> </RadialGradientBrush.GradientStops> </RadialGradientBrush></Window.Resources><Button Background="{DynamicResource ResourceKey=btnbrush}" Width="100" Height="100"></Button></Window>
8. Resources: Example
![Page 116: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/116.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
8. Resources: Example StaticResource vs DynamicResource
Static resources are resolved at compile time, whereas dynamic resources are resolved at runtime.
Use DynamicResources when the value of the resource could change during the lifetime of the Application.
Use StaticResources when it’s clear that you don’t need your resource re-evaluated when fetching it – static resources perform better than dynamic resources.
![Page 117: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/117.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
8. Resources: Visual Tree DynamicBackground="{DynamicResource ResourceKey=keyBrush}"
![Page 118: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/118.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
8. Resources: Visual Tree StaticBackground="{StaticResource ResourceKey=gradBrush}"
![Page 119: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/119.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
8. Resources dictionaryStored in a central place (file) Is a collection of resources that can be
easily incorporated into an application Can be used to contain a single reference
to all the assemblies in a single or multiple applications better for re_using
Example in next slide
![Page 120: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/120.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
<ResourceDictionary …> <LinearGradientBrush x:Key="btnbrush"> <GradientStop Color="AliceBlue" Offset="0" /> <GradientStop Color="Blue" Offset=".7" /> </LinearGradientBrush></ResourceDictionary>
Dictionary2.xaml
<Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionary2.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary></Window.Resources><Button Background="{DynamicResource ResourceKey= btnbrush}" Width="100" Height="50">Hello</Button>
Using Dictionary2.xaml
![Page 121: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/121.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Stylegroup of property settings apply that style to many different elements set the inner properties of a XAML element
using setters – Setters require two attributes
Property & Value Can set event triggers – applies itself whenever a target condition is evaluated to true
![Page 122: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/122.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Key Style Name Suffix ↓ ↓ <Style x:Key="buttonStyle"> <Setter Property="Button.Height" Value="40" /> <Setter Property="Button.Width" Value="110"/> <Setter Property="Button.FontSize" Value="16"/> <Setter Property="Button.FontWeight" Value="Bold"/> </Style> ↑ ↑ ↑ Property Setters for a Named Value Attribute Style Must Include a Attribute Class Name
9. Style: named style
<Button Style="{StaticResource buttonStyle}">Button 1</Button>
![Page 123: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/123.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style<Button Content="Button 1"> <Button.Style> <Style> <Setter Property="Button.Height" Value="40" /> <Setter Property="Button.Width" Value="110" /> <Setter Property="Button.FontSize" Value="16" /> <Setter Property="Button.FontWeight" Value="Bold" /> </Style> </Button.Style></Button> <Window.Resources>
<Style …> <Setter …/> <Setter …/> </Style> </Window.Resources>
![Page 124: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/124.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style
Declare in Resource Two ways Named styles –give the style a name when declare. Targeted styles –give the style a target type when declare. The style is then automatically applied to elements of that type.
![Page 125: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/125.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: example TargetType<ResourceDictionary …> <Style TargetType="{x:Type Button}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="AliceBlue" Offset="0" /> <GradientStop Color="Blue" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="FontSize" Value="20" /> <Setter Property="Width" Value="150"/> <Setter Property="Height" Value="50"/> </Style></ResourceDictionary>
targetstyle.xaml
![Page 126: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/126.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: example TargetType<Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="targetstyle.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary></Window.Resources><Button Content="FIT HUI"/>
![Page 127: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/127.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: named style
![Page 128: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/128.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: named style
![Page 129: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/129.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: Targeted Styles
Set TargetType attribute to the exact type of the elements on which to apply the style.
– The style will not be applied to elements of types derived from the specified type. Do not set the x:Key attribute. The Setters do not require a class name
with the property name.
![Page 130: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/130.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: Targeted Styles<Window.Resources> Set the target type. ↓ <Style TargetType="Button"> <Setter Property="FontSize" Value="16" /> <Setter Property="FontWeight" Value="Bold"/> </Style> ↑ No Class Name</Window.Resources><GroupBox Header="Some Buttons" BorderBrush="Black" Margin="5"> <StackPanel> <Button>Button 1</Button> ← No Explicit Application of the Style <Button>Button 2</Button> ← No Explicit Application of the Style </StackPanel></GroupBox>
![Page 131: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/131.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: Comparing
![Page 132: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/132.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: The Collections in a Style
Trigger: “conditional” styles Resources property to store logical
resources used by the Setters and Triggers.
![Page 133: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/133.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: Property TriggersThe condition is based on the value of a
property. When (and while) that property has a certain value, the style is applied
<Window.Resources> <Style TargetType="Button"> <EventSetter Event="Click" Handler="btn_click"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Background" Value="Red"/> <Setter Property="FontWeight" Value="Bold"/> </Trigger> </Style.Triggers> </Style></Window.Resources><Button Content="Hello" ></Button>
![Page 134: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/134.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
9. Style: EventSettersEventSetters allow to attach event
handlers to a style <Window.Resources> <Style TargetType="Button"> <EventSetter Event="Click" Handler="btn_click"/> </Style></Window.Resources>public void btn_click
(object o, RoutedEventArgs e) { ((Button)o).Content = "Clicked"; }
![Page 135: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/135.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
10. Control templateOverride the default user interface for
common Windows controls are XAML declarations of a "visual tree"
for a control replace the default look & feel define the functionality behind the control
![Page 136: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/136.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
10. Control template: example<Window.Resources> <ControlTemplate x:Key= "tmpl" TargetType="{x:Type Button}"> <Border BorderBrush="Navy" BorderThickness="1" CornerRadius="5" Background="CornflowerBlue"> <Border BorderBrush="White" BorderThickness="3"> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> <Label Content="My button" Grid.Row="0" Margin="0" /> <ContentPresenter Grid.Row="1"/> </Grid> </Border> </Border> </ControlTemplate></Window.Resources><Button Content="More text" Template="{DynamicResource tmpl}"/>
![Page 137: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/137.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Data bindingIs the process that establishes a connection
between the application UI and businesslogic. Automatically updated to reflect the change
![Page 138: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/138.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Simple bindingBinding from one control to another Property to property
– ElementName, Path Example
<StackPanel> <TextBox Name="txt" Text="{Binding ElementName=slider , Path=Value}"/> <Label Content ="{Binding ElementName=txt , Path=Text}"/> <Slider Name="slider"></Slider></StackPanel>
![Page 139: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/139.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding structure
![Page 140: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/140.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Simple binding: example 2<StackPanel><TextBlock Text="Colors:"/> <ListBox x:Name="lbColor"> <ListBoxItem Content="Blue"/> <ListBoxItem Content="Green"/> <ListBoxItem Content="Red"/> </ListBox> <TextBlock Text="You selected color:"/> <TextBlock Background="{Binding ElementName=lbColor, Path =SelectedItem.Content}"> <TextBlock.Text> <Binding ElementName="lbColor" Path="SelectedItem.Content"/> </TextBlock.Text> </TextBlock></StackPanel>
![Page 141: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/141.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding DirectionOneWay: Updates the target when the source
changes. TwoWay: Updates in both directions. Updates the
target when the source changes and updates the source when the target changes.
OneWayToSource: Updates the source when the target changes.
OneTime: Updates the target property once, with the source’s initial value. After that, the target isn’t updated again.
Default: Uses the default binding mode of the target.
![Page 142: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/142.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding Direction
![Page 143: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/143.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding Direction:Triggers
The behavior for updating depends on the direction of the update, as follows: When the direction of the update is from
the source to the target, the update always happens immediately.
When the direction of the update is from the target to the source, then when the update occurs depends on the value of the UpdateSourceTrigger property of the Binding.
![Page 144: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/144.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding Direction:TriggersSummary of the update behavior based on direction of the update
![Page 145: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/145.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
11. Binding Direction:Triggers
<StackPanel><TextBox Margin="10" Text="{Binding ElementName=sldrSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" /><Slider Name="sldrSlider" TickPlacement="TopLeft" Margin="10"/></StackPanel>
![Page 146: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/146.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsTransforms – Transforms allow you to modify the appearance of an element in specific ways. BitmapEffects Shapes
![Page 147: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/147.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsRotateTransform
<Button Content="Rotate Me" > <Button.RenderTransform> <RotateTransform Angle="45"/> </Button.RenderTransform></Button>
![Page 148: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/148.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsTranslateTransform
Moves an element to a different position
<StackPanel HorizontalAlignment="Center"> <Button Width="70">Button 1</Button> <Button Width="70"> Move Right 30 <Button.RenderTransform>↓ <TranslateTransform X="30" Y="10"/> </Button.RenderTransform> ↑
Move Down 10 Button 2 </Button> <Button Width="70">Button 3</Button></StackPanel>
![Page 149: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/149.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsSkewTransform
Skews an element at an angle. Can skew the X or Y coordinates
![Page 150: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/150.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsSkewTransform
<StackPanel HorizontalAlignment="Center"> <Button>No Skew</Button> <Button Width="90" FontWeight="Bold" Margin="2"> <Button.RenderTransform> <SkewTransform AngleX="30"/> </Button.RenderTransform> AngleX="30" </Button> <Button Width="90" FontWeight="Bold" Margin="2"> <Button.RenderTransform> <SkewTransform AngleY="30"/> </Button.RenderTransform> AngleY="30" </Button></StackPanel>
![Page 151: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/151.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsSkewTransform<Button Name="SkewButton" Width="122" Content="Skew Me!" Click="btn_click"> <Button.RenderTransform> <SkewTransform x:Name="Trans_SkewButton"
CenterX="75" CenterY="37" AngleX="0" AngleY="0" /> </Button.RenderTransform></Button>public void btn_click(object sender, System.Windows.RoutedEventArgs e){ double skew = 30; if (Trans_SkewButton.AngleX == 30) skew = 0; Trans_SkewButton.AngleX = skew; Trans_SkewButton.AngleY = skew;}
![Page 152: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/152.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objectsScaleTransform
Transform changes the size of an element<StackPanel HorizontalAlignment="Center"> <Button Width="70">Button 1</Button> <Button Width="70"> <Button.LayoutTransform> <ScaleTransform ScaleX="1.75" ScaleY="1.5"/> </Button.LayoutTransform> Button 2</Button><Button Width="70">Button 3</Button></StackPanel>
![Page 153: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/153.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objects: BitmapEffects <Button Content="Button"> <Button.BitmapEffect> <EmbossBitmapEffect /> </Button.BitmapEffect></Button>
![Page 154: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/154.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objects: Shapes6 basic typed
![Page 155: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/155.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
12. Graphic objects: Shapes6 basic typed
![Page 156: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/156.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY12. Graphic objects: Shapes<StackPanel Orientation="Vertical" HorizontalAlignment="Center"> <Rectangle Stroke="Black" StrokeThickness="2" Margin="10" Height="30" Width="40"Fill="AliceBlue"/><Ellipse Stroke="Black" StrokeThickness="2" Margin="10" Height="30" Width="40" Fill="AliceBlue"/> <Line Stroke="Black" StrokeThickness="2" Margin="10" X1="0" Y1="0" X2="40" Y2="30"/> <Polyline Stroke="Black"
StrokeThickness="2" Margin="10" Points="0,0 30,0 10,30 40,30"/> <Polygon Stroke="Black" StrokeThickness="2" Margin="10" Points="0,0 30,0 10,30 40,30"/></StackPanel>
![Page 157: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/157.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
13. MS Expression Blend
IntrodutionMicrosoft Expression Blend 4 Step by Step
http://www.mediafire.com/?ckv9wv1qkdnl45a
![Page 158: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/158.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Exercise WPF:1. Tạo contact application – Sử dụng VS kết hợp Blend thiết kế giao diện • Listbox danh sách /button: thêm, sửa, xóa,lưu • Dùng style để thay đổi giao diện tất cả button giống nhau, tất cả textbox giống nhau. • Dùng Style/trigger thay đổi giao diện các textbox (background, fontsize) khi di chuyển chuột trên các textbox này • Dùng Trigger để màu các textbox thay đổi khi thay đổi chế độ soạn thảo • Thay đổi Style, transform, BitmapEffect thay đổi giao diện button • Bổ sung một đồng hồ kim giờ - phút – giây phía trái màn hình
![Page 159: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/159.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
Exercise WPF: Using WPF app (con’t) – Display contact app. – Next/Pre/First/Last menu using icon – Display contact list with same icon in Listbox, Treeview Using Expression Blend – Change Style – Change template – Using transform, BitmapEffect for buttons
![Page 160: windows presentation foundation](https://reader033.vdocuments.us/reader033/viewer/2022052523/55561baad8b42a3f168b54af/html5/thumbnails/160.jpg)
HO CHI MINH UNIVERSITY OF INDUSTRY
END