SlideShare a Scribd company logo
WPF Layout Containers Panels, Tab Containers Doncho Minkov Telerik School Academy schoolacademy.telerik.com   Technical Trainer h ttp://www.minkov.it
Table of Contents Containers Overview Containers in XAML Three Kinds of Containers (Panels) Absolute coordinates, Stacking, Proportional GridSplitters and Sizing XAML Tab Containers
Containers Overview What is a Container? Containers in XAML
What is a Container? A containers is something that contains other things In HTML  divs   and  spans  are containers They hold another controls / tags Used to represent the layout of the application Every container is given a space to consume All his children are in this space
Containers in WPF  In WPF containers are called  Panels Three common types of panels Panels with absolute coordinates Panels with stacking order Panels with proportional or with rows/columns Absolute coordinates Panels Canvas Controls inside the canvas are arranged based on the  Canvas  position and size
Containers in WPF (2) Stacking Panels StackPanel ,  DockPanel ,  WrapPanel Elements are arranged in a stacking order i.e. first come goes in the beginning Proportional Panels Grid  and  UniformGrid Arrange the elements in a table-like layout
The  Canvas  Container
The  Canvas  Container The  Canvas  is a  layout   container It’s an element that holds  other elements It simply positions each item using fixed coordinates Places elements behind or in front of others (depending on the z-order) Supports size and clipping
The  Canvas  Container (2) Positioning elements in a  Canvas Using  attached properties Here’s an example that places a  Rectangle   at specific  location in a  Canvas <Canvas> <Rectangle Canvas.Left=&quot;30&quot; Canvas.Top=&quot;30&quot; Fill=&quot;Red&quot; Width=&quot;100&quot; Height=&quot;100&quot;/> … </Canvas>
The  Canvas  Container (3) Placing elements behind or in front of others depends on the z-order Defines which elements are “on top of” the other elements The default z-order  Determined by the order in which the children are added to the  Canvas Customize the z-order of any child element using  Canvas.ZIndex  attached property
The  Canvas  Container – Example < Canvas  Background=&quot;White&quot; Height=&quot;680&quot;> <Rectangle Canvas.Left=&quot;0&quot; Canvas.Top=&quot;0&quot; Fill=&quot;Red&quot; Width=&quot;100&quot; Height=&quot;100&quot;  Canvas.ZIndex =&quot;3&quot; /> <Rectangle Canvas.Left=&quot;20&quot; Canvas.Top=&quot;20&quot; Fill=&quot;Orange&quot; Width=&quot;100&quot; Height=&quot;100&quot; Canvas.ZIndex =&quot;2&quot; /> <Canvas Canvas.Left=&quot;300&quot; Canvas.Top=&quot;300&quot; Canvas.ZIndex =&quot;1&quot;> <Rectangle Width=&quot;120&quot; Height=&quot;330&quot; RadiusX=&quot;20&quot; RadiusY=&quot;20&quot; Fill=&quot;Black&quot;/> <Ellipse Canvas.Left=&quot;10&quot; Canvas.Top=&quot;10&quot; Width=&quot;100&quot; Height=&quot;100&quot; Fill=&quot;Red&quot;/> </Canvas> </Canvas>
Customize the Z-order and  Multiple   Canvas  Elements Live Demo
Stacking Panels StackPanel, DockPanel, Wrap Panel
StackPanel The  StackPanel  arranges the elements in one row/column  Depends on the orientation property If the size of each element is not explicitly set all elements have the same width/height Can set flow orientation Vertical or Horizontal <StackPanel> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> </StackPanel>
WrapPanel The  WrapPanel  is much like  StackPanel  but if the end of the available space is reached Arranges the elements in the next row/columns Depends on the orientation property Example: <WrapPanel> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/>  <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> </WrapPanel>
DockPanel The  DockPanel   provides docking of elements to the  left ,  right ,  top ,  bottom  of the panel Defined by the attached property  Dock To dock an element to the center of the panel, it must be the last child of the panel  LastChildFill   property must be set to true. <DockPanel LastChildFill=&quot;True&quot;> <Button Content=&quot;Top&quot; DockPanel.Dock=&quot;Top&quot;/> <Button Content=&quot;Bottom&quot; DockPanel.Dock=&quot;Bottom&quot;/> <Button Content=&quot;Left&quot;/> <Button Content=&quot;Right&quot; DockPanel.Dock=&quot;Right&quot;/> <Button Content=&quot; LastChildFill=True &quot;/> </DockPanel>
Stacking Panels Live Demo
Proportional Panels Grid and UniformGrid
Grid Panel The most powerful layout container in WPF Everything can be done with  Grid Sometimes a way harder than using  StackPanel Arranges the elements in a  table-like  layout Predefined  number of rows and columns Each element has  explicitly  set grid row/column Using the attached properties  Grid.Row   and  Grid.Column If no columns/rows are defined, works the like canvas
Grid Panel (2) Number of  rows  is defined by a content property called &quot; RowDefinitions &quot; Each row can be set a  height It is the same with &quot; ColumnDefinitions &quot; <Grid.RowDefinitions> <RowDefinition  Height=&quot;50&quot; /> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition  Width=&quot;50&quot; /> </Grid.ColumnDefinitions>
Grid Panel (3) Each of the elements in a  Grid  should have a  Grid.Row  and/or  Grid.Column  property set <Grid> … <Button Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; Content=&quot;{0, 0}&quot;/> <Button Grid.Row=&quot;0&quot; Grid.Column=&quot;1&quot; Content=&quot;{0, 1}&quot;/> <Button Grid.Row=&quot;1&quot; Grid.Column=&quot;0&quot; Content=&quot;{1, 0}&quot;/> <Button Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; Content=&quot;{1, 1}&quot;/> <Button Grid.Row=&quot;2&quot; Grid.Column=&quot;0&quot; Content=&quot;{2, 0}&quot;/> <Button Grid.Row=&quot;2&quot; Grid.Column=&quot;1&quot; Content=&quot;{2, 1}&quot;/> </Grid>
UniformGrid Panel Much like the common  Grid  panel Cannot set position explicitly Each elements is with the  same size Fills the elements depending of the number of rows/columns FlowDirection  property sets the arrange style of the elements <UniformGrid Rows=&quot;3&quot;> <Button  Content=&quot;First&quot;/> … <Button Content=&quot;Seventh&quot;/> </UniformGrid>
Proportional Panels Live Demo
GridSplitters
GridSplitter Offer the user a way to adjust the layout of your application  Changing the size of a column or row in a grid Use  GridSplitter  only to rearrange a Grid panel <Grid Height=&quot;100&quot; Width=&quot;400&quot;> <Grid.ColumnDefinitions>…</Grid.ColumnDefinitions> <Ellipse Grid.Column=&quot;0&quot; Fill=&quot;Red&quot; /> <GridSplitter Grid.Column=&quot;1&quot; HorizontalAlignment=&quot;Stretch&quot; /> <Ellipse Grid.Column=&quot;2&quot; Fill=&quot;Blue&quot; /> </Grid>
GridSplitter Live Demo
Sizing
Sizing There are a number of properties to set the size of a panel or the elements in it Width ,  Height ,  MaxWidth ,  MaxHeight ,  MinWidth ,  MinHeight Padding  and  Margin <StackPanel> <Button Content=&quot;First&quot; Margin=&quot;1&quot; Padding=&quot;5&quot;  Height=&quot;50&quot; Width=&quot;Auto&quot;/> … <Button Content=&quot;Fifth&quot; Margin=&quot;5&quot; Padding=&quot;1&quot;  Height=&quot;50&quot; Width=&quot;Auto&quot;/> </StackPanel>
Sizing Live Demo
Border Container
Border Container The Border container is a special kind of container It can hold only one child element The child element becomes surrounded by a border The Border properties for border style BorderBrush BorderThickness CornerRadius
Border Example Lets make a window with no Windows border, rounded corners and transparent background <Window … WindowStyle=&quot;None&quot;/> <Border BorderThickness=&quot;5&quot; Background=&quot;Transparent&quot;  CornerRadius=&quot;10&quot;> <Border.BorderBrush> <LinearGradientBrush StartPoint=&quot;0,0&quot; EndPoint=&quot;0,1&quot;> <GradientStop Color=&quot;Blue&quot; Offset=&quot;0.2&quot;/> <GradientStop Color=&quot;DarkBlue&quot; Offset=&quot;0.8&quot;/> </LinearGradientBrush> </Border.BorderBrush> … </Border> Lets have no Windows Border
Border Container Live Demo
TabControl
TabContol TabControl  is useful for switching between multiple pages of content Tabs in a  TabControl  are typically placed on the top TabStripPlacement  property  can set their placement to  Left ,  Right , or  Bottom <TabControl> <TabItem Header=&quot;Tab 1&quot;>Content for Tab1.</TabItem> <TabItem Header=&quot;Tab 2&quot;>Content for Tab2.</TabItem> <TabItem Header=&quot;Tab 3&quot;>Content for Tab3.</TabItem> </TabControl>
TabControl Live Demo
XAML Layout Containers
Exercises Create the following: *Note : Don't use  Grid  for everything
Exercises (2) Create the following: *Note : Don't use  Grid  for everything
Exercises (3) Using Tabs create the previous XAMLs in tab controls Add  GridSplitter   whenever you used Grid as a panel

More Related Content

PPT
WPF Graphics and Animations
PPTX
WPF Line of Business Application XAML Layouts Presentation
PPT
WPF Controls
PPT
Windows Programming with AWT
DOCX
Graphic Programming
PPTX
java-Unit4 chap2- awt controls and layout managers of applet
PPTX
tL19 awt
KEY
A fresh look at graphical editing
WPF Graphics and Animations
WPF Line of Business Application XAML Layouts Presentation
WPF Controls
Windows Programming with AWT
Graphic Programming
java-Unit4 chap2- awt controls and layout managers of applet
tL19 awt
A fresh look at graphical editing

What's hot (20)

KEY
2011 10-24-initiatives-tracker-launch-v1.0
PDF
Notes netbeans
PPTX
PPTX
VISUAL BASIC 6 - CONTROLS AND DECLARATIONS
PPT
28 awt
PPT
Basic of Abstract Window Toolkit(AWT) in Java
PPT
Java swing
PPTX
JAVA AWT
PPT
Awt controls ppt
PPTX
GUI programming
PPTX
Awt components
PPTX
Objects and classes in Visual Basic
PDF
The AWT and Swing
PDF
Railway Oriented Programming
PDF
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
PPTX
Creating Maps With Style
PPT
Java awt
PPSX
Dr. Rajeshree Khande :Introduction to Java AWT
PDF
Java awt tutorial javatpoint
2011 10-24-initiatives-tracker-launch-v1.0
Notes netbeans
VISUAL BASIC 6 - CONTROLS AND DECLARATIONS
28 awt
Basic of Abstract Window Toolkit(AWT) in Java
Java swing
JAVA AWT
Awt controls ppt
GUI programming
Awt components
Objects and classes in Visual Basic
The AWT and Swing
Railway Oriented Programming
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Creating Maps With Style
Java awt
Dr. Rajeshree Khande :Introduction to Java AWT
Java awt tutorial javatpoint
Ad

Similar to WPF Layout Containers (20)

PPT
Kml Basics Chpt 2 Placemarks
PPT
ImplementingChangeTrackingAndFlagging
PPT
Tables and Forms in HTML
PPT
5.2 nesting and floating elements
ODP
Introduction into Struts2 jQuery Grid Tags
PPT
Csphtp1 18
PPT
Understandable Content and Controls
PPTX
Google Earth Tutorials Part III
PDF
Wpf Introduction
PPT
Cleveland Silverlight Firestarter - XAML Basics
PPT
Css advanced – session 5
PPT
Hibernate Session 2
PPT
Lecture 2 - Comm Lab: Web @ ITP
PPT
ASP.NET 10 - Data Controls
PPTX
1-06: More HTML Elements
PPTX
1 06-more html-elements
PPT
Flex For Flash Developers Ff 2006 Final
PPT
Javascript Experiment
PPT
Kml Basics Chpt 2 Placemarks
ImplementingChangeTrackingAndFlagging
Tables and Forms in HTML
5.2 nesting and floating elements
Introduction into Struts2 jQuery Grid Tags
Csphtp1 18
Understandable Content and Controls
Google Earth Tutorials Part III
Wpf Introduction
Cleveland Silverlight Firestarter - XAML Basics
Css advanced – session 5
Hibernate Session 2
Lecture 2 - Comm Lab: Web @ ITP
ASP.NET 10 - Data Controls
1-06: More HTML Elements
1 06-more html-elements
Flex For Flash Developers Ff 2006 Final
Javascript Experiment
Ad

More from Doncho Minkov (20)

PDF
Web Design Concepts
PPT
Web design Tools
PPT
PPT
HTML 5 Tables and Forms
PPT
CSS Overview
PPT
CSS Presentation
PPT
CSS Layout
PPT
PPT
Adobe Photoshop
PPT
Slice and Dice
PPT
Introduction to XAML and WPF
PPT
WPF Templating and Styling
PPT
Simple Data Binding
PPT
Complex Data Binding
PPT
WPF Concepts
PPT
Model View ViewModel
PPT
WPF and Databases
PPT
Introduction to Cross-platform Mobile Development Course
PPT
HTML Fundamentals
PPT
Web Design Concepts
Web design Tools
HTML 5 Tables and Forms
CSS Overview
CSS Presentation
CSS Layout
Adobe Photoshop
Slice and Dice
Introduction to XAML and WPF
WPF Templating and Styling
Simple Data Binding
Complex Data Binding
WPF Concepts
Model View ViewModel
WPF and Databases
Introduction to Cross-platform Mobile Development Course
HTML Fundamentals

Recently uploaded (20)

DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PDF
Reconciliation AND MEMORANDUM RECONCILATION
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PDF
A Brief Introduction About Julia Allison
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PDF
MSPs in 10 Words - Created by US MSP Network
PDF
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
PPTX
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
PDF
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
PDF
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
PDF
How to Get Funding for Your Trucking Business
DOCX
Business Management - unit 1 and 2
PDF
Power and position in leadershipDOC-20250808-WA0011..pdf
PDF
IFRS Notes in your pocket for study all the time
PPTX
Principles of Marketing, Industrial, Consumers,
PPTX
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
PDF
Nidhal Samdaie CV - International Business Consultant
PPTX
New Microsoft PowerPoint Presentation - Copy.pptx
PPTX
Amazon (Business Studies) management studies
unit 1 COST ACCOUNTING AND COST SHEET
Reconciliation AND MEMORANDUM RECONCILATION
Roadmap Map-digital Banking feature MB,IB,AB
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
A Brief Introduction About Julia Allison
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
MSPs in 10 Words - Created by US MSP Network
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
How to Get Funding for Your Trucking Business
Business Management - unit 1 and 2
Power and position in leadershipDOC-20250808-WA0011..pdf
IFRS Notes in your pocket for study all the time
Principles of Marketing, Industrial, Consumers,
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
Nidhal Samdaie CV - International Business Consultant
New Microsoft PowerPoint Presentation - Copy.pptx
Amazon (Business Studies) management studies

WPF Layout Containers

  • 1. WPF Layout Containers Panels, Tab Containers Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer h ttp://www.minkov.it
  • 2. Table of Contents Containers Overview Containers in XAML Three Kinds of Containers (Panels) Absolute coordinates, Stacking, Proportional GridSplitters and Sizing XAML Tab Containers
  • 3. Containers Overview What is a Container? Containers in XAML
  • 4. What is a Container? A containers is something that contains other things In HTML divs and spans are containers They hold another controls / tags Used to represent the layout of the application Every container is given a space to consume All his children are in this space
  • 5. Containers in WPF In WPF containers are called Panels Three common types of panels Panels with absolute coordinates Panels with stacking order Panels with proportional or with rows/columns Absolute coordinates Panels Canvas Controls inside the canvas are arranged based on the Canvas position and size
  • 6. Containers in WPF (2) Stacking Panels StackPanel , DockPanel , WrapPanel Elements are arranged in a stacking order i.e. first come goes in the beginning Proportional Panels Grid and UniformGrid Arrange the elements in a table-like layout
  • 7. The Canvas Container
  • 8. The Canvas Container The Canvas is a layout container It’s an element that holds other elements It simply positions each item using fixed coordinates Places elements behind or in front of others (depending on the z-order) Supports size and clipping
  • 9. The Canvas Container (2) Positioning elements in a Canvas Using attached properties Here’s an example that places a Rectangle at specific location in a Canvas <Canvas> <Rectangle Canvas.Left=&quot;30&quot; Canvas.Top=&quot;30&quot; Fill=&quot;Red&quot; Width=&quot;100&quot; Height=&quot;100&quot;/> … </Canvas>
  • 10. The Canvas Container (3) Placing elements behind or in front of others depends on the z-order Defines which elements are “on top of” the other elements The default z-order Determined by the order in which the children are added to the Canvas Customize the z-order of any child element using Canvas.ZIndex attached property
  • 11. The Canvas Container – Example < Canvas Background=&quot;White&quot; Height=&quot;680&quot;> <Rectangle Canvas.Left=&quot;0&quot; Canvas.Top=&quot;0&quot; Fill=&quot;Red&quot; Width=&quot;100&quot; Height=&quot;100&quot; Canvas.ZIndex =&quot;3&quot; /> <Rectangle Canvas.Left=&quot;20&quot; Canvas.Top=&quot;20&quot; Fill=&quot;Orange&quot; Width=&quot;100&quot; Height=&quot;100&quot; Canvas.ZIndex =&quot;2&quot; /> <Canvas Canvas.Left=&quot;300&quot; Canvas.Top=&quot;300&quot; Canvas.ZIndex =&quot;1&quot;> <Rectangle Width=&quot;120&quot; Height=&quot;330&quot; RadiusX=&quot;20&quot; RadiusY=&quot;20&quot; Fill=&quot;Black&quot;/> <Ellipse Canvas.Left=&quot;10&quot; Canvas.Top=&quot;10&quot; Width=&quot;100&quot; Height=&quot;100&quot; Fill=&quot;Red&quot;/> </Canvas> </Canvas>
  • 12. Customize the Z-order and Multiple Canvas Elements Live Demo
  • 13. Stacking Panels StackPanel, DockPanel, Wrap Panel
  • 14. StackPanel The StackPanel arranges the elements in one row/column Depends on the orientation property If the size of each element is not explicitly set all elements have the same width/height Can set flow orientation Vertical or Horizontal <StackPanel> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> </StackPanel>
  • 15. WrapPanel The WrapPanel is much like StackPanel but if the end of the available space is reached Arranges the elements in the next row/columns Depends on the orientation property Example: <WrapPanel> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Yellow&quot;/> <TextBlock Text=&quot;Text&quot; Background=&quot;Blue&quot;/> </WrapPanel>
  • 16. DockPanel The DockPanel provides docking of elements to the left , right , top , bottom of the panel Defined by the attached property Dock To dock an element to the center of the panel, it must be the last child of the panel LastChildFill property must be set to true. <DockPanel LastChildFill=&quot;True&quot;> <Button Content=&quot;Top&quot; DockPanel.Dock=&quot;Top&quot;/> <Button Content=&quot;Bottom&quot; DockPanel.Dock=&quot;Bottom&quot;/> <Button Content=&quot;Left&quot;/> <Button Content=&quot;Right&quot; DockPanel.Dock=&quot;Right&quot;/> <Button Content=&quot; LastChildFill=True &quot;/> </DockPanel>
  • 18. Proportional Panels Grid and UniformGrid
  • 19. Grid Panel The most powerful layout container in WPF Everything can be done with Grid Sometimes a way harder than using StackPanel Arranges the elements in a table-like layout Predefined number of rows and columns Each element has explicitly set grid row/column Using the attached properties Grid.Row and Grid.Column If no columns/rows are defined, works the like canvas
  • 20. Grid Panel (2) Number of rows is defined by a content property called &quot; RowDefinitions &quot; Each row can be set a height It is the same with &quot; ColumnDefinitions &quot; <Grid.RowDefinitions> <RowDefinition Height=&quot;50&quot; /> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width=&quot;50&quot; /> </Grid.ColumnDefinitions>
  • 21. Grid Panel (3) Each of the elements in a Grid should have a Grid.Row and/or Grid.Column property set <Grid> … <Button Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; Content=&quot;{0, 0}&quot;/> <Button Grid.Row=&quot;0&quot; Grid.Column=&quot;1&quot; Content=&quot;{0, 1}&quot;/> <Button Grid.Row=&quot;1&quot; Grid.Column=&quot;0&quot; Content=&quot;{1, 0}&quot;/> <Button Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; Content=&quot;{1, 1}&quot;/> <Button Grid.Row=&quot;2&quot; Grid.Column=&quot;0&quot; Content=&quot;{2, 0}&quot;/> <Button Grid.Row=&quot;2&quot; Grid.Column=&quot;1&quot; Content=&quot;{2, 1}&quot;/> </Grid>
  • 22. UniformGrid Panel Much like the common Grid panel Cannot set position explicitly Each elements is with the same size Fills the elements depending of the number of rows/columns FlowDirection property sets the arrange style of the elements <UniformGrid Rows=&quot;3&quot;> <Button Content=&quot;First&quot;/> … <Button Content=&quot;Seventh&quot;/> </UniformGrid>
  • 25. GridSplitter Offer the user a way to adjust the layout of your application Changing the size of a column or row in a grid Use GridSplitter only to rearrange a Grid panel <Grid Height=&quot;100&quot; Width=&quot;400&quot;> <Grid.ColumnDefinitions>…</Grid.ColumnDefinitions> <Ellipse Grid.Column=&quot;0&quot; Fill=&quot;Red&quot; /> <GridSplitter Grid.Column=&quot;1&quot; HorizontalAlignment=&quot;Stretch&quot; /> <Ellipse Grid.Column=&quot;2&quot; Fill=&quot;Blue&quot; /> </Grid>
  • 28. Sizing There are a number of properties to set the size of a panel or the elements in it Width , Height , MaxWidth , MaxHeight , MinWidth , MinHeight Padding and Margin <StackPanel> <Button Content=&quot;First&quot; Margin=&quot;1&quot; Padding=&quot;5&quot; Height=&quot;50&quot; Width=&quot;Auto&quot;/> … <Button Content=&quot;Fifth&quot; Margin=&quot;5&quot; Padding=&quot;1&quot; Height=&quot;50&quot; Width=&quot;Auto&quot;/> </StackPanel>
  • 31. Border Container The Border container is a special kind of container It can hold only one child element The child element becomes surrounded by a border The Border properties for border style BorderBrush BorderThickness CornerRadius
  • 32. Border Example Lets make a window with no Windows border, rounded corners and transparent background <Window … WindowStyle=&quot;None&quot;/> <Border BorderThickness=&quot;5&quot; Background=&quot;Transparent&quot; CornerRadius=&quot;10&quot;> <Border.BorderBrush> <LinearGradientBrush StartPoint=&quot;0,0&quot; EndPoint=&quot;0,1&quot;> <GradientStop Color=&quot;Blue&quot; Offset=&quot;0.2&quot;/> <GradientStop Color=&quot;DarkBlue&quot; Offset=&quot;0.8&quot;/> </LinearGradientBrush> </Border.BorderBrush> … </Border> Lets have no Windows Border
  • 35. TabContol TabControl is useful for switching between multiple pages of content Tabs in a TabControl are typically placed on the top TabStripPlacement property can set their placement to Left , Right , or Bottom <TabControl> <TabItem Header=&quot;Tab 1&quot;>Content for Tab1.</TabItem> <TabItem Header=&quot;Tab 2&quot;>Content for Tab2.</TabItem> <TabItem Header=&quot;Tab 3&quot;>Content for Tab3.</TabItem> </TabControl>
  • 38. Exercises Create the following: *Note : Don't use Grid for everything
  • 39. Exercises (2) Create the following: *Note : Don't use Grid for everything
  • 40. Exercises (3) Using Tabs create the previous XAMLs in tab controls Add GridSplitter whenever you used Grid as a panel

Editor's Notes

  • #8: * (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #13: * (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
  • #27: * 02/25/12 07/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##