WPF布局示例1

WPF布局示例1

看了刘铁猛老师的深入签出WPF教程以后,学会了一些基础的内容。就决定动手练习,这个是按照B站上面的教程一步一步跟着坐下来的Demo.一是记录自己学习的过程,二是给需要学习的朋友一点参考
<Window x:Class="WPF_basic0.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WPF_basic0"
        mc:Ignorable="d"
        Title="MainWindow" Height="700" Width="400" >
    <Border Padding="10">
        <StackPanel>
            <!--BUttons-->
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Button Name="btnApply" Grid.Column="0" Margin="0 0 10 0">Apply</Button>
                <Button Name="btnReset" Grid.Column="1">Reset</Button>
                <Button Name="btnRefresh" Grid.Column="2" Margin="10 0 0 0" >Refresh</Button>
            </Grid>
            
            <TextBlock Text="Pulse Properties"  FontWeight="Bold" Margin="0 10"/>
            <!--Description-->
            <TextBlock Text="Description" />
            <TextBox Name="DescriptionTxb" Padding="2"/>
            <!--Status and Revision-->
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <!-- Status -->
                <StackPanel Margin="0 0 10 0" Grid.Column="0">
                    <TextBlock Text="Status" Grid.Column="0" HorizontalAlignment="Left"/>
                    <TextBox Padding="2" IsReadOnly="True" Background="#eee"/>
                </StackPanel>
                <!-- Revision -->
                <StackPanel Orientation="Vertical" Grid.Column="1">
                    <TextBlock Text="Status" Grid.Column="0" HorizontalAlignment="Left"/>
                    <TextBox Padding="2" IsReadOnly="True" Background="#eee"/>
                </StackPanel>
                
             
                
            </Grid>
            
            <!-- Part Nnumber -->
            <StackPanel>
                <TextBlock Text="Part Number"/>
                <TextBox Padding="2" IsReadOnly="True" Background="#eee"/>
            </StackPanel>
            
            <!-- Raw Material-->
            <StackPanel >
                <TextBlock Text="Raw Material" FontWeight="Bold"/>
                <TextBlock Text="Raw Material" Margin="0 10 0 0"/>
                <ComboBox Padding="2" IsReadOnly="True" Background="#eee"/>

            </StackPanel>

            <!-- Manufacturing Info-->
            <StackPanel>
                <TextBlock Text="Manufacturing Info" FontWeight="Bold"/>
                <TextBlock Text="Work Centres" Margin="0 10 0 10"/>
            </StackPanel>
            
            <!-- CheckBox-->
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <!-- Column1 -->
                <StackPanel Grid.Column="0">
                    <CheckBox Content="Weild"/>
                    <CheckBox Content="Assembly"/>
                    <CheckBox Content="Plasma"/>
                    <CheckBox Content="Laser"/>
                    <CheckBox Content="Purchase"/>

                </StackPanel>
                <!-- Column2 -->
                <StackPanel Grid.Column="1">
                    <CheckBox Content="Lathe"/>
                    <CheckBox Content="Drill"/>
                    <CheckBox Content="Fold"/>
                    <CheckBox Content="Roll"/>
                    <CheckBox Content="Saw"/>

                </StackPanel>
            </Grid>
            
            <!-- Length -->
            <StackPanel>
                <TextBlock Text="Length"/>
                <TextBox Padding="2"/>
            </StackPanel>

            <!-- Mass -->
            <StackPanel >
                <TextBlock Text="Mass"/>
                <TextBox Padding="2" IsReadOnly="True" Background="#eee"/>
            </StackPanel>

            <!-- Finished -->
            <StackPanel >
                <TextBlock Text="Finished"/>
                <ComboBox SelectedIndex="0" Padding="2">
                    <ComboBoxItem>Painted</ComboBoxItem>
                    <ComboBoxItem>NOt Painted</ComboBoxItem>
                </ComboBox>
            </StackPanel>
            <!-- Purchase Information -->
            <StackPanel >
                <TextBlock Text="Purchase Information"/>
                <ComboBox SelectedIndex="0" Padding="2">
                    <ComboBoxItem>Rubber</ComboBoxItem>
                    <ComboBoxItem>NOt Rubber</ComboBoxItem>
                </ComboBox>
            </StackPanel>
            <!-- Supplier Name -->
            <StackPanel >
                <TextBlock Text="Supplier Name"/>
                <TextBox Padding="2" />
            </StackPanel>

            <!-- Supplier Code -->
            <StackPanel >
                <TextBlock Text="Supplier Code"/>
                <TextBox Padding="2" />
            </StackPanel>
            <!-- Additional Info -->
            <StackPanel Margin="0 10 0 0" >
                <TextBlock Text="Additional Info" FontWeight="Bold"/>
                <TextBlock Text="Note" Margin="0 10 0 0"/>
                <TextBox/>
            </StackPanel>
        </StackPanel>
    </Border>
</Window>


界面的设计效果如下:在这里插入图片描述
在这里插入图片描述
参考视频

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值