Windows Presentation Foundation Layout with Panels

Slides:



Advertisements
Similar presentations
Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
Panels, Tab Containers Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
RIA User User RIA .net framework Silverlight, WPF.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Tutorial 6 Creating Fixed-Width Layouts
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
Mahender Sarangam Having close to 5 years of experience. Working as a Senior Software Engineer in United Health Group. Good Knowledge on C#, ASP.NET,
MORE Cascading Style Sheets (The Positioning Model)
GUI Layout Managers Arkadiusz Edward Komenda. Outline Components and Containers Layout Managers Flow Layout Grid Layout Border Layout Nested Containers.
Chapter 5 Creating Page Templates
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
1 Intro XAML Attribute syntax & property syntax Panels Reusable resources Controls Data binding Steen Jensen, spring 2014.
Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC
 Website development process  CSS  Javascript.
LAYOUT CONTROLS. XAML Overview XAML : eXtensible Application Markup Language pronounced (ZAMEL) is a markup language used to design user interfaces XML-based.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Week 5 Working with Tables. 2 Understanding Table Basics.
Chapter 4 Working with Frames. Align and distribute objects on a page Stack and layer objects Work with graphics frames Work with text frames Chapter.
CSS Layout Arrangement and Positioning of the HTML Elements Svetlin Nakov Technical Trainer Software University
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
Layout With Panels. Canvas Most basic panel Position with explicit coordinates Attached properties: Left, Top, Right, Bottom HorizontalAlignment and VerticalAlignment.
Chapter 5 Creating Page Templates. Principles of Web Design 2nd Ed. Chapter 5 2 Principles of Web Design Chapter 5 Objectives Understand table basics.
Chapter 5 Working with Tables Principles of Web Design, 4 th Edition.
Layout with Styles Castro Chapter 11. Tables vs. CSS You can produce “liquid layouts” (layouts that stretch as the browser is resized) using tables or.
Module 3 Designing and Developing a User Interface.
Positioning and Printing Creating Special Effects with CSS.
© 2011 Delmar, Cengage Learning Chapter 4 Working with Frames.
CSS Layout Arrangement and Positioning of the HTML Elements SoftUni Team Technical Trainers Software University
Tutorial 4 Creating Page Layouts with CSS
Pasewark & Pasewark 1 Excel Lesson 3 Organizing the Worksheet Microsoft Office 2007: Introductory.
Adding Tables to Slides Lesson 5. Software Orientation Tables are designed to organize data in columns and rows, as shown at right. The Table Tools Design.
Layouts To understand various layouts extjs provides, and overview of some commonly used layouts.
Jaime Rodriguez | Microsoft Principal Technical Evangelist Laurent Bugnion | IdentityMine Senior Director XAML Deep Dive for Windows & Windows Phone Apps.
Tutorial 4 Using CSS for Page Layout. Objectives Session 4.1 – Explore CSS layout – Compare types of floating layouts – Examine code for CSS layouts –
CSS.
Jim Fawcett, Brown Bag Seminar Series Fall 2007
Laying out Elements with CSS
Windows Presentation Foundation
Cascading Style Sheets Boxes
Microsoft Office 2007-Illustrated
Jim Fawcett, Brown Bag Seminar Series Fall 2007
Tables and Frames.
UWA Responsive design.
Floating & Positioning
Adapting UI for Different Screens and Orientations
Programming the Web using XHTML and JavaScript
Chap 7. Building Java Graphical User Interfaces
The Internet 10/25/11 XHTML Tables
Enhancing a Document Part 1
03 | Building Windows Store Apps with XAML Part 3
Graphical User Interfaces -- Introduction
Objectives Create a reset style sheet Explore page layout designs
Layouts AKEEL AHMED.
WPF AKEEL AHMED.
Enhancing a Document Part 1
Positioning.
Windows Presentation Foundation
Tutorial 3 – Creating a Multiple-Page Report
DREAMWEAVER MX 2004 Chapter 3 Working with Tables
Floating and Positioning
Positioning.
CSS Boxes CS 1150 Fall 2016.
Sizing, Positioning, and Transforming Elements
Cascading Style Sheets CSS LAYOUT WITH GRID
Presentation transcript:

Windows Presentation Foundation Layout with Panels By Kester Marrain

Chapter Overview Canvas StackPanel WrapPanel DockPanel Grid Primitive Panels Handling Content Overflow

Examples of Bad Layout

CANVAS The canvas is the most basic panel. Canvas only supports the “classic” notion of positioning elements with explicit coordinates (coordinates are device independent pixels). Canvas also enables you to specify coordinates relative to any corner of it.

Canvas - continued Elements can be positioned by using a canvas’ attached properties: Left, Top, Right, Bottom and ZIndex. In essence, choosing the corner in which to “dock” each element and attached properties serve as margins. Elements cannot use more than two of the canvas’ attached properties.

Canvas - Continued

Canvas - Continued

Canvas - continued

Stack Panel Stack panels do not define their own attached properties. There is only one way to customize the behavior of StackPanel – setting its orientation property to Horizontal or Vertical (Vertical is the default).

Stack Panel - continued

Stack Panel - continued When FlowDirection is set to RightToLeft, stacking occurs right to left for a stack panel with a horizontal orientation.

Stack Panel - continued

Stack Panel - continued

Wrap Panel - continued Similar to StackPanel but in addition to stacking, it wraps its child elements to additional rows and columns when there is not enough space for a single stack. Like a stack panel the wrap panel has no attached properties for controlling element positions.

Wrap Panel - continued Defines three properties for controlling its elements behavior: Orientation – Just like stack panel with default of horizontal. ItemHeight - A uniform height for all child elements. ItemWidth – A uniform width for all child elements.

Wrap Panel - continued You can force wrap panels to arrange elements in a single row or column by setting its Width for Horizontal and Height for Vertical to Double.MaxValue or Double.PositiveInfinity. In XAML this must be done using the x:Static markup extension.

Wrap Panel - continued

Wrap Panel - continued

Dock Panel Dock Panel enables easy docking of elements to an entire side of a panel, stretching it to fill the entire width or height. It also enables a single element to fill the remaining space unused by the docked element. Dock Panel has a Dock attached property, so children can control their docking with one of four properties: Left, Right, Top, Bottom.

Dock Panel – continued

Dock Panel - continued

Dock Panel - continued

Grid Grid is the most versatile panel. Enables arrangement of children in a multi-row or multi-column fashion. Has Row, RowSpan, Column and ColumnSpan attached properties. Grid cells can be left empty and multiple elements can appear in the same Grid cell.

Grid - continued

Grid - continued

Grid – Sizing the Rows and Columns RowDefinition and ColumnDefinition properties do not default to Auto. They are of type System.Windows.GridLength rather than double. Grid supports three different types of RowDefinition and ColumnDefinition sizing: Absolute Sizing Auto Sizing Proportional Sizing

Grid – Sizing the Rows and Columns - continued

Grid – Converter, Splitters, and More System.Windows.GridLengthConverter is the type converter that converts strings to GridLength structures. Interactive sizing of rows and columns is accomplished using a GridSplitter. Any number of GridSplitter can be added to a Grid. The GridSplitter attached properties are Grid.Row, Grid.Column, Grid.RowSpan, GridColumnSpan, ResizeDirection, ResizeBehavior and SharedSizeGroup.

Grid – Converter, Splitters, and More - continued The best way to use GridSplitter is to place it in its own autosized row or column. To avoid overlapping the existing content in the adjacent cells. If it is in a cell with other content it should be added last so it has the topmost Z order. The GridSplitter must be given an explicit width or height to be seen.

Grid – Converter, Splitters, and More - continued

Grid – Converter, Splitters, and More - continued

Grid – Converter, Splitters, and More - continued

Grid – Converter, Splitters, and More - continued

Comparing Grid to other Panels A single row and single column Grid with HorizontalAlignment and VerticalAlignment of all children to values other than stretch Grid functions like a Canvas. A single column Grid with autosized rows looks like a vertical stack panel. Using RowSpan and ColumnSpan a Grid is emulate a dock panel.

Grid’s Interaction with Child Layout Properties

Primitive Panels Exist in the System.Windows.Controls.Primitives namespace except for ToolBarTray. TabPanel default style for TabControl and can be thought of as a lightweight Wrap Panel. ToolBarOverflowPanel default style of ToolBar and also similar to Wrap Panel.

Primitive Panels - continued ToolBarTray only supports ToolBar children and arranges ToolBar sequentially horizontally. UniformGrid simplified Grid where all rows and columns are of size *.

Handling Content Overflow Can be done using one of the following strategies: Clipping Scrolling Scaling Wrapping Trimming

Handling Content Overflow - Clipping Clipping (truncating or cropping) is the default way that panels handle content that is to large. All UIElements have a Boolean ClipToBounds property that controls whether a child element can be rendered outside of its bounds. Clipping occurs before RenderTransforms are applied.

Handling Content Overflow - Scrolling To accomplish scrolling simply wrap an element in a System.Windows.Controls.ScrollViewer. ScrollViewer uses the ScrollBar control and hooks it up to the content automatically.

Handling Content Overflow - Scrolling

Handling Content Overflow - Scrolling VirtualizingStackPanel acts like a Stack Panel, but it temporarily discards any items off-screen to optimize performance (only when data binding).

Handling Content Overflow - Scaling The Viewbox control provides an easy mechanism to scale arbitrary content within a given space. Viewbox is a type of Decorator and only has one child element. By default Viewbox stretches in both dimensions to fill space given to it. Viewbox removes all wrapping.

Handling Content Overflow - Scaling The StretchDirection property of Viewbox controls whether content should be shrunk, enlarged or both. UpOnly DownOnly Both Viewbox has a stretch property to control how its single child gets scaled within its bounds. The property is an enumeration consisting of: None Fill Uniform (Default) UniformToFill

Handling Content Overflow - Scaling

Handling Content Overflow - Scaling

Reference Sams Windows Presentation Foundation Unleashed WPF by Adam Nathan.