SlideShare une entreprise Scribd logo
1  sur  35
Don Burnett
http://blog.donburnett.com
http://www.uxmagic.com
Microsoft Expression M.V.P. 2008-2009
   Panels
   Advanced Panels
   Transformations
   Layout Engine
   Panels In WPF
   Canvas
   StackPanel
   WrapPanel
   DockPanel
   Grid
   Columns and Rows
   Star Sizing
   Properties That Affect Layout
   Properties That Relate to Layout
   Demo: Panels
   Panels are responsible for layout
   Framework panels:
       Canvas
       StackPanel
       WrapPanel
       DockPanel
       Grid
Top, Left                               Top, Right




                   Y



               X


                        Absolute
                       Positioning




Bottom, Left                         Bottom, Right
   The Canvas panel enables absolute position, and
    it is the closest panel to the layout available in
    traditional Windows Forms applications. Objects
    placed within the Canvas are not
    clipped, therefore, if you arranged a Button on a
    Canvas with a Height and Width of zero, the
    Button will still be visible, relative to the top-left
    corner of the Canvas.

   Position by using attached properties:
     Canvas.Left
     Canvas.Top
     Canvas.Bottom
     Canvas.Right
   Stacks child elements together
   Orientation:
       Vertical
       Horizontal
   The StackPanel layout panel stacks child elements
    together. The Orientation property determines the
    direction in which elements are stacked. Setting
    Orientation property to Vertical, the default, stacks
    elements on top of one another; the width of the
    panel becomes infinite. Setting the Orientation
    property to Horizontal stacks elements next to one
    another; the height of the panel becomes infinite.
   Stacks child elements together
   When the bounds of the panel are exceeded child
    elements are wrapped
   Orientation:
     Horizontal
     Vertical
   The WrapPanel layout panel stacks child elements
    together, similar to the StackPanel, but once the
    bounds of the panel have been reached the child
    elements within the panel are wrapped.
   The Orientation property determines the direction
    in which elements are stacked. Setting the
    Orientation property to Horizontal, the
    default, stacks elements next to one another and
    the panel wraps under the existing elements.
    Setting the Orientation property to Vertical stacks
    elements on top of one another; the panel wraps
    child elements next to one another.
Top

Left          Right

       Bottom




 LastChildFill
   The DockPanel layout panel that stack (MP
    replace “that stack” with” stacks”) child
    elements either horizontally or
    vertically, relative to each other based on
    the Dock attached property, (MP replace
    “,” with “;”) possible values are Left (the
    default), Right, Top, and Bottom.
   The LastChildFill boolean property
    specifies if the (MP remove “if the”)
    whether the last child element within the
    panel stretches to fill the remaining
    available space.
Column = 0      Column = 1      Column = 2


Row = 0
                         Row = 0
                        Column = 0
Row = 1                RowSpan = 3
                                          Row = 0
                                         Column = 2

Row = 2


                                         Row = 3
Row = 3                                Column = 0
                                     ColumnSpan = 2
   Grid rows are defined by:
       RowDefinition objects
   Grid columns are defined by:
       ColumnDefinition objects
   Use GridLength values to represent:
       Height of a row
                                   <Grid>
       Width of a column            <Grid.RowDefinitions>
                                       <RowDefinition Height='100' />
                                       <RowDefinition Height=‘Auto'/>
                                     </Grid.RowDefinitions>
                                     <Grid.ColumnDefinitions>
                                       <ColumnDefinition Width='50' />
                                       <ColumnDefinition Width='100'/>
                                       <ColumnDefinition Width=‘*‘/>
                                     </Grid.ColumnDefinitions>
                                   </Grid>
   Star sizing is used to express proportional values
   Star values can be weighted, for example:
   Star sizing is used to express values as a weighted
    proportion of available space.

   The first example breaks the columns into the ratio of
    50 percent for the first column and 25 percent for the
    remaining columns. The second example uses a fixed
    size of 300 for the last column, the first column then
    has 25 percent of the remaining space, after the 300
    has been allocated to the last column; and then the
    middle column takes up the remaining space.

   Star sizing is very flexible and enables many different
    grid configurations.
   HorizontalAlignment- Specifies how an element should be aligned from side to side.
   VerticalAlignment- Specifies how an element should be aligned from top to bottom.
   Margin- Specifies distance between content of a control and it’s margins or border.
   Padding- Amount of space between the content of a Control and it’s margin or border.



                                                                   Margin between an
                                                                   element and any
                                                                   other child elements
                                        Text box



     Padding around
     element
   ClipToBounds. True for clipping its children.
   Clip. Geometry used to define the outline of the contents of an
    element.
   Visibility:
    Collapsed – layout will ignore
    Hidden – not visible but still affects layout

           Panel (Canvas) area

                          Text box           Canvas.ClipToBounds = False


                          Text          Canvas.ClipToBounds = True
   VirtualizingPanel
   Custom Panels
   A virtualized panel displays the UI elements that
    are visible.
   You often have more child elements than are
    actually visible. Virtualization optimizes UI creation
    by creating child elements when they are visible.
   Abstract class that enables UI virtualization
   Does not enable data virtualization
   VirtualizingStackPanel
       ListBox


VirtualizingPanel is an abstract class that provides the
   foundation for building panels that need to virtualize
   their child elements. The VirtualizingPanel enables UI
   virtualization, but not data virtualization. WPF provides
   one VirtualizingPanel implementation, the
   VirtualizingStackPanel. The VistualizingStackPanel is
   the default items host for the ListBox control.
   Transforms In WPF
   Render Transforms
   Layout Transforms
   Demo: Transforms
   Framework Transforms:
       ScaleTransform
       TranslateTransform
       SkewTransform
       RotateTransform
       TransformGroup                     Before Transform

                             Scale      Translate    Skew     Rotate




                             Scale
                                     Translate
                                           After Transform
   All UIElements have a RenderTransform property
   Transforms applied to RenderTransform do not
    affect layout


                            Before Transform

                  Button 1      Button 2      Button 3
                   Rotate       Rotate         Rotate




                            After Transform
   All FrameworkElements have a LayoutTransform
    property
   Transforms applied to the LayoutTransform
    property affect layout

                           Before Transform

                 Button 1     Button 2       Button 3
                  Rotate       Rotate         Rotate




                           After Transform
•   ScaleTransform
•   TranslateTransform
•   SkewTransform
•   RotateTransform
   “Layout” is the sizing and positioning of visual
    elements within a user interface
   Layout Elements (Panels):
       Maintains a collection of child elements
       Are responsible for sizing child elements
       Are responsible for positioning child elements
1.   Inherit from Panel (or anything else)
2.   Implement MeasureOverride
     •   Call Measure on each child
3.   Implement ArrangeOverride
     •   Call Arrange on each child
public class CustomPanel : Panel
{
    protected override Size MeasureOverride(Size availableSize)
    {
        foreach (UIElement child in InternalChildren)
        {
            child.Measure(availableSize);
            ...
        }

    }
    protected override Size ArrangeOverride(Size finalSize)
    {
        foreach (UIElement child in InternalChildren)
        {
           child.Arrange(...);
            ...
        }

    }
}
   There are usually two reasons to create a custom panel:
•    Performance
•    Algorithmic Layout

   Creating a new panel for performances reasons is a rare occurrence; but, for
    example the UniformGrid was created for performance reasons.
   Algorithmic layout means a layout that is based on a algorithm as opposed
    to positional layout; for example, child elements positioned along a circular
    path.

   To write a custom Panel inherit from Panel. WPF has a two phase model for
    layout, a measure and a arrange phase; the MeasureOverride and
    ArrangeOverride methods must be implemented. It is very important that in
    each phase you call the appropriate Measure and Arrange methods on each
    child; or it is very likely WPF will not render the child element.

   A great example of custom panels can be found in “Kevin’s Bag-o-Tricks” by
    Kevin Moore : http://j832.com/bagotricks/
Don Burnett
http://blog.donburnett.com
http://www.uxmagic.com
Microsoft Expression M.V.P. 2008-2009

Contenu connexe

Similaire à WPF Line of Business Application XAML Layouts Presentation

Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingJadavsejal
 
Star logo nova code cookbook
Star logo nova  code cookbookStar logo nova  code cookbook
Star logo nova code cookbookBarbara M. King
 
Star logo nova code cookbook(1)
Star logo nova  code cookbook(1)Star logo nova  code cookbook(1)
Star logo nova code cookbook(1)Barbara M. King
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy ValuesJuriy Zaytsev
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2sleguiza
 
Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window ToolkitRutvaThakkar1
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsNaman Dwivedi
 
Angular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsAngular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsBrent Goldstein
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz
 
Taming the browser with the YUI Dom Component
Taming the browser with the YUI Dom ComponentTaming the browser with the YUI Dom Component
Taming the browser with the YUI Dom ComponentChristian Heilmann
 
Manual Layout Revisited
Manual Layout RevisitedManual Layout Revisited
Manual Layout Revisitedgillygize
 
03 layouts & ui design - Android
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - AndroidWingston
 

Similaire à WPF Line of Business Application XAML Layouts Presentation (20)

Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
 
Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event Handling
 
Visual State Manager
Visual State ManagerVisual State Manager
Visual State Manager
 
Star logo nova code cookbook
Star logo nova  code cookbookStar logo nova  code cookbook
Star logo nova code cookbook
 
Star logo nova code cookbook(1)
Star logo nova  code cookbook(1)Star logo nova  code cookbook(1)
Star logo nova code cookbook(1)
 
03 unity 3_d_part_2
03 unity 3_d_part_203 unity 3_d_part_2
03 unity 3_d_part_2
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
 
Bootstrap 4 ppt
Bootstrap 4 pptBootstrap 4 ppt
Bootstrap 4 ppt
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
Abstract Window Toolkit
Abstract Window ToolkitAbstract Window Toolkit
Abstract Window Toolkit
 
2. react - native: basic
2. react - native: basic2. react - native: basic
2. react - native: basic
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animations
 
Angular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web ApplicationsAngular.js Directives for Interactive Web Applications
Angular.js Directives for Interactive Web Applications
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016
 
Layout manager
Layout managerLayout manager
Layout manager
 
Ruby Classes
Ruby ClassesRuby Classes
Ruby Classes
 
Taming the browser with the YUI Dom Component
Taming the browser with the YUI Dom ComponentTaming the browser with the YUI Dom Component
Taming the browser with the YUI Dom Component
 
Manual Layout Revisited
Manual Layout RevisitedManual Layout Revisited
Manual Layout Revisited
 
03 layouts & ui design - Android
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - Android
 

Plus de Our Community Exchange LLC

Plus de Our Community Exchange LLC (10)

Real Time Connected Vehicle Networking with HDInsight and Apache Storm
Real Time Connected Vehicle Networking with HDInsight and Apache StormReal Time Connected Vehicle Networking with HDInsight and Apache Storm
Real Time Connected Vehicle Networking with HDInsight and Apache Storm
 
2012 Updated Portfolio
2012 Updated Portfolio2012 Updated Portfolio
2012 Updated Portfolio
 
Roi and user experience
Roi and user experienceRoi and user experience
Roi and user experience
 
I phone versus windows phone 7 coding
I phone versus windows phone 7 codingI phone versus windows phone 7 coding
I phone versus windows phone 7 coding
 
U Xmagic Agile Presentation
U Xmagic Agile PresentationU Xmagic Agile Presentation
U Xmagic Agile Presentation
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
 
WPF Line of Business Control Templates Styles
WPF Line of Business Control Templates StylesWPF Line of Business Control Templates Styles
WPF Line of Business Control Templates Styles
 
WPF Fundamentals
WPF FundamentalsWPF Fundamentals
WPF Fundamentals
 
Wpf Tech Overview2009
Wpf Tech Overview2009Wpf Tech Overview2009
Wpf Tech Overview2009
 
New Introductionfor Flash Designers
New Introductionfor Flash DesignersNew Introductionfor Flash Designers
New Introductionfor Flash Designers
 

Dernier

DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...Rishabh Aryan
 
cda.pptx critical discourse analysis ppt
cda.pptx critical discourse analysis pptcda.pptx critical discourse analysis ppt
cda.pptx critical discourse analysis pptMaryamAfzal41
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作7tz4rjpd
 
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services DubaiDubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubaikojalkojal131
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造kbdhl05e
 
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改yuu sss
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girlsssuser7cb4ff
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一Fi L
 
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...mrchrns005
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social MediaD SSS
 
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一Fi ss
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case StudySophia Viganò
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一F La
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degreeyuu sss
 

Dernier (20)

DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
DAKSHIN BIHAR GRAMIN BANK: REDEFINING THE DIGITAL BANKING EXPERIENCE WITH A U...
 
cda.pptx critical discourse analysis ppt
cda.pptx critical discourse analysis pptcda.pptx critical discourse analysis ppt
cda.pptx critical discourse analysis ppt
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作
 
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services DubaiDubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
Dubai Calls Girl Tapes O525547819 Real Tapes Escort Services Dubai
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造
 
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girls
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一
办理学位证加州州立大学洛杉矶分校毕业证成绩单原版一比一
 
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
Business research proposal mcdo.pptxBusiness research proposal mcdo.pptxBusin...
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media
 
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case Study
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
 

WPF Line of Business Application XAML Layouts Presentation

  • 2.
  • 3. Panels  Advanced Panels  Transformations  Layout Engine
  • 4.
  • 5. Panels In WPF  Canvas  StackPanel  WrapPanel  DockPanel  Grid  Columns and Rows  Star Sizing  Properties That Affect Layout  Properties That Relate to Layout  Demo: Panels
  • 6. Panels are responsible for layout  Framework panels:  Canvas  StackPanel  WrapPanel  DockPanel  Grid
  • 7. Top, Left Top, Right Y X Absolute Positioning Bottom, Left Bottom, Right
  • 8. The Canvas panel enables absolute position, and it is the closest panel to the layout available in traditional Windows Forms applications. Objects placed within the Canvas are not clipped, therefore, if you arranged a Button on a Canvas with a Height and Width of zero, the Button will still be visible, relative to the top-left corner of the Canvas.  Position by using attached properties:  Canvas.Left  Canvas.Top  Canvas.Bottom  Canvas.Right
  • 9. Stacks child elements together  Orientation:  Vertical  Horizontal
  • 10. The StackPanel layout panel stacks child elements together. The Orientation property determines the direction in which elements are stacked. Setting Orientation property to Vertical, the default, stacks elements on top of one another; the width of the panel becomes infinite. Setting the Orientation property to Horizontal stacks elements next to one another; the height of the panel becomes infinite.
  • 11. Stacks child elements together  When the bounds of the panel are exceeded child elements are wrapped  Orientation:  Horizontal  Vertical
  • 12. The WrapPanel layout panel stacks child elements together, similar to the StackPanel, but once the bounds of the panel have been reached the child elements within the panel are wrapped.  The Orientation property determines the direction in which elements are stacked. Setting the Orientation property to Horizontal, the default, stacks elements next to one another and the panel wraps under the existing elements.  Setting the Orientation property to Vertical stacks elements on top of one another; the panel wraps child elements next to one another.
  • 13. Top Left Right Bottom LastChildFill
  • 14. The DockPanel layout panel that stack (MP replace “that stack” with” stacks”) child elements either horizontally or vertically, relative to each other based on the Dock attached property, (MP replace “,” with “;”) possible values are Left (the default), Right, Top, and Bottom.  The LastChildFill boolean property specifies if the (MP remove “if the”) whether the last child element within the panel stretches to fill the remaining available space.
  • 15. Column = 0 Column = 1 Column = 2 Row = 0 Row = 0 Column = 0 Row = 1 RowSpan = 3 Row = 0 Column = 2 Row = 2 Row = 3 Row = 3 Column = 0 ColumnSpan = 2
  • 16. Grid rows are defined by:  RowDefinition objects  Grid columns are defined by:  ColumnDefinition objects  Use GridLength values to represent:  Height of a row <Grid>  Width of a column <Grid.RowDefinitions> <RowDefinition Height='100' /> <RowDefinition Height=‘Auto'/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width='50' /> <ColumnDefinition Width='100'/> <ColumnDefinition Width=‘*‘/> </Grid.ColumnDefinitions> </Grid>
  • 17. Star sizing is used to express proportional values  Star values can be weighted, for example:
  • 18. Star sizing is used to express values as a weighted proportion of available space.  The first example breaks the columns into the ratio of 50 percent for the first column and 25 percent for the remaining columns. The second example uses a fixed size of 300 for the last column, the first column then has 25 percent of the remaining space, after the 300 has been allocated to the last column; and then the middle column takes up the remaining space.  Star sizing is very flexible and enables many different grid configurations.
  • 19. HorizontalAlignment- Specifies how an element should be aligned from side to side.  VerticalAlignment- Specifies how an element should be aligned from top to bottom.  Margin- Specifies distance between content of a control and it’s margins or border.  Padding- Amount of space between the content of a Control and it’s margin or border. Margin between an element and any other child elements Text box Padding around element
  • 20. ClipToBounds. True for clipping its children.  Clip. Geometry used to define the outline of the contents of an element.  Visibility: Collapsed – layout will ignore Hidden – not visible but still affects layout Panel (Canvas) area Text box Canvas.ClipToBounds = False Text Canvas.ClipToBounds = True
  • 21.
  • 22. VirtualizingPanel  Custom Panels
  • 23. A virtualized panel displays the UI elements that are visible.  You often have more child elements than are actually visible. Virtualization optimizes UI creation by creating child elements when they are visible.
  • 24. Abstract class that enables UI virtualization  Does not enable data virtualization  VirtualizingStackPanel  ListBox VirtualizingPanel is an abstract class that provides the foundation for building panels that need to virtualize their child elements. The VirtualizingPanel enables UI virtualization, but not data virtualization. WPF provides one VirtualizingPanel implementation, the VirtualizingStackPanel. The VistualizingStackPanel is the default items host for the ListBox control.
  • 25.
  • 26. Transforms In WPF  Render Transforms  Layout Transforms  Demo: Transforms
  • 27. Framework Transforms:  ScaleTransform  TranslateTransform  SkewTransform  RotateTransform  TransformGroup Before Transform Scale Translate Skew Rotate Scale Translate After Transform
  • 28. All UIElements have a RenderTransform property  Transforms applied to RenderTransform do not affect layout Before Transform Button 1 Button 2 Button 3 Rotate Rotate Rotate After Transform
  • 29. All FrameworkElements have a LayoutTransform property  Transforms applied to the LayoutTransform property affect layout Before Transform Button 1 Button 2 Button 3 Rotate Rotate Rotate After Transform
  • 30. ScaleTransform • TranslateTransform • SkewTransform • RotateTransform
  • 31. “Layout” is the sizing and positioning of visual elements within a user interface  Layout Elements (Panels):  Maintains a collection of child elements  Are responsible for sizing child elements  Are responsible for positioning child elements
  • 32. 1. Inherit from Panel (or anything else) 2. Implement MeasureOverride • Call Measure on each child 3. Implement ArrangeOverride • Call Arrange on each child
  • 33. public class CustomPanel : Panel { protected override Size MeasureOverride(Size availableSize) { foreach (UIElement child in InternalChildren) { child.Measure(availableSize); ... } } protected override Size ArrangeOverride(Size finalSize) { foreach (UIElement child in InternalChildren) { child.Arrange(...); ... } } }
  • 34. There are usually two reasons to create a custom panel: • Performance • Algorithmic Layout  Creating a new panel for performances reasons is a rare occurrence; but, for example the UniformGrid was created for performance reasons.  Algorithmic layout means a layout that is based on a algorithm as opposed to positional layout; for example, child elements positioned along a circular path.  To write a custom Panel inherit from Panel. WPF has a two phase model for layout, a measure and a arrange phase; the MeasureOverride and ArrangeOverride methods must be implemented. It is very important that in each phase you call the appropriate Measure and Arrange methods on each child; or it is very likely WPF will not render the child element.  A great example of custom panels can be found in “Kevin’s Bag-o-Tricks” by Kevin Moore : http://j832.com/bagotricks/

Notes de l'éditeur

  1. Panels are responsible for the layout of a collection of UIElement-derived children. When the Measure method is called on a panel, it must measure all its children. When the Arrange method is called on a panel, it then must arrange its children.
  2. The Grid layout panel positions child elements within rows and columns. By default there is only a single row and column in to which all elements are placed.Each child element is positioned within the grid by using attached properties:Grid.RowGrid.ColumnGrid.RowSpanGrid.ColumnSpan
  3. The Grid layout panel has two collections for managing rows and columns: RowDefinitions and ColumnsDefinitions respectively. The RowDefinitions collection is populated by using RowDefinition objects and theColumnsDefinitions collection is populated by using ColumnDefinition objects.The RowDefinition class defines a Height property of type GridLength and ColumnDefinition defines a Width property also of type GridLength. Combining these property values creates the layout for the grid. The GridLength class enable values beyond simple numbers to be assigned to the height and widths of rows and columns, values such as “Auto” and “*” can also be applied.Auto. The size is determined by the content.*. Uses all the available space to the panel, and is also used with “Star Sizing”, covered in the next topic.
  4. Transforms can be used throughout WPF to effect the size, shape and position of elements. A transform defines how to map points from one position to another position by using a transformation matrix. Applying the transformation matrix to certain values, depending on the transformation required, on a target object delivers the rotation, skew, scale, and move transformation effects. All transforms in WPF are affine transforms. An affine transform is a mathematical transformation that preserves parallel lines. All 2D transforms derive from System.Windows.Media.Transform class.ScaleTransform. Scales an object in the 2-D x-y coordinate system.TranslateTransform. Translates (moves) an object in the 2-D x-y coordinate system.SkewTransform. Skews an object in 2-D space.RotateTransform. Rotates an object clockwise about a specified point in a 2-D x-y coordinate system.TransformGroup. Transforms can be combined using a TransformGroup object.
  5. Any RenderTransform is applied immediately before rendering, therefore only having an impact on the rendering, as opposed to have an impact on layout.
  6. Any LayoutTransform is applied before layout, therefore affecting the layout of the FrameworkElement. Translate transforms are ignored in LayoutTransform.
  7. You can use the sample XAML file <install path>\\Module 03\\Demos\\Transforms\\TransformTypesExample.xaml to help with the demonstration.Show the impact of applying the transforms to the following properties:RenderTransformLayoutTransformYou can use the sample XAML file <install path>\\Module 03\\Demos\\Transforms\\TransformsExample.xaml to help with the demonstration.
  8. WPF contains several layout elements: Canvas, StackPanel, DockPanel, Grid, etc.
  9. There are usually two reasons to create a custom panel: Performance Algorithmic LayoutCreating a new panel for performances reasons is a rare occurrence; but, for example the UniformGrid was created for performance reasons.Algorithmic layout means a layout that is based on a algorithm as opposed to positional layout; for example, child elements positioned along a circular path.To write a custom Panel inherit from Panel. WPF has a two phase model for layout, a measure and a arrange phase; the MeasureOverride and ArrangeOverride methods must be implemented. It is very important that in each phase you call the appropriate Measure and Arrange methods on each child; or it is very likely WPF will not render the child element.A great example of custom panels can be found in “Kevin’s Bag-o-Tricks”, a whole host of WPF custom feature implementations, including panels, a great tool for learning how WPF works and how to extend it: http://j832.com/bagotricks/