wpf 研习1-24小时自学wpf4

Layout

 

Panel,Decorator;

System.Windows.Controls.Control;

System.Windows.FrameworkElement;

(VerticalAlignment, HorizontalAlignment, and Margin property)

 

 
wpf 研习1-24小时自学wpf4
 

DockPanel has intutive "intelligence"-dynamic layout mechanism

DockPanel,commonly root layout control;

DockPanel.Dock-attached property;

DockPanel.SetDock(theButton, Dock.Right);

 

Grid can do more by xaml and attached properties

wpf 研习1-24小时自学wpf4

<Window x:Class=”AdvancedGrid.Window1”
                   xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
                   xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
                   Title=”Window1”
                   Height=”480”
                   Width=”600”>

 

<Grid TextBlock.FontSize=”48”>
    <Grid.RowDefinitions>
       <RowDefinition />
               <RowDefinition Height=”250” />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
              <ColumnDefinition Width=”2*” />
              <ColumnDefinition Width=”auto” />
              <ColumnDefinition Width=”*” />
              <ColumnDefinition Width=”*” />
     </Grid.ColumnDefinitions>
     <Button Grid.RowSpan=”2”
                   Content=”2 Rows” />
               <GridSplitter Grid.Row=”0”
                    Grid.RowSpan=”2”
                    Grid.Column=”1”
                    Width=”8”
                    Background=”Black”
                    ResizeBehavior=”PreviousAndNext”
                    ResizeDirection=”Columns” />
      <Button Grid.Column=”2”
                    Grid.ColumnSpan=”2”
                    Content=”2 Columns” />
       <Button Grid.Row=”1”
                     Grid.Column=”2”
                     Content=”1,2” />
       <Button Grid.Row=”1”
                     Grid.Column=”3”
                     Content=”1,3” />
        </Grid>
</Window>

 

WrapPanel;

Canvas-a last resort;

 

Decorator-Border,ViewBox;BulletDecorator;

 

扩展:

Radial Panel;