wpf 研习1-24小时自学wpf4

本文详细介绍了WPF中的DockPanel和Grid布局,包括DockPanel的智能动态布局特性、Dock Attached属性的使用,以及Grid的多行多列设置和GridSplitter的灵活调整功能。此外,还提及了WrapPanel和Canvas的基本应用,以及Decorator组件如Border和ViewBox的作用。
摘要由CSDN通过智能技术生成

Layout

 

Panel,Decorator;

System.Windows.Controls.Control;

System.Windows.FrameworkElement;

(VerticalAlignment, HorizontalAlignment, and Margin property)

 

 

 

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

<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;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值