• Menu 菜单栏


    XAML中的菜单栏不再像WINFORM一样有一个专用的控件来实现它,我们通过DockPanel来实现这样的一个功能。

    <Window x:Class="MaterialStorage.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="20"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="20"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" ></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <DockPanel Grid.Row="0" Grid.Column="1" Height="20" HorizontalAlignment="Stretch" Name="dockPanel1" Margin="0" VerticalAlignment="Top">
                <Menu Name="menu1" Width="Auto" DockPanel.Dock="Top"
    VerticalAlignment="Center"  >
                    <MenuItem Header="文件">
                        <MenuItem Header="报表导出" Name="newMember" />
                        <MenuItem Header="数据备份" Name="saveMember" />
                        <Separator/>
                        <MenuItem Header="关闭" Name="exit"  Click="Exit_Click" />
                    </MenuItem>
                    <MenuItem Header="关于" Click="About_Click"  />
                </Menu>
            </DockPanel>
            <Grid Grid.Row="1" Grid.Column="1" Background="Beige">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40*"></RowDefinition>
                    <RowDefinition Height="40*"></RowDefinition>
                    <RowDefinition Height="20*"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" ></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid Grid.Row="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="25*" ></ColumnDefinition>
                        <ColumnDefinition Width="75*" ></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock Padding="10,0,0,0">领取物料:</TextBlock>
                    </StackPanel>
                    <WrapPanel Name="Materials" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="0">
                        
                    </WrapPanel>
                </Grid>
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="3"></RowDefinition>
                        <RowDefinition Height="*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="25*" ></ColumnDefinition>
                        <ColumnDefinition Width="75*" ></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Line Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Name="barLine1" Stroke="BurlyWood" StrokeThickness="3" VerticalAlignment="Top"></Line>
                    <WrapPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left">
                        <TextBlock Padding="10,0,0,0" VerticalAlignment="Center">领取数量:</TextBlock>
                        <TextBox Name="MaterialQuantity" Grid.Column="1" Width="50" Height="20" VerticalAlignment="Center"></TextBox>
                    </WrapPanel>
                    <WrapPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left">
                        <TextBlock Padding="10,0,0,0" VerticalAlignment="Center">领取人:</TextBlock>
                        <WrapPanel Name="Picker" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="0">
    
                        </WrapPanel>
                    </WrapPanel>
                </Grid>
                <Grid Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="3"></RowDefinition>
                        <RowDefinition Height="*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="25*" ></ColumnDefinition>
                        <ColumnDefinition Width="75*" ></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Line Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Name="barLine2" Stroke="BurlyWood" StrokeThickness="3" VerticalAlignment="Top"></Line>
                    <WrapPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center">
                        <Button VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" Click="Button1_Click">确定</Button>
                    </WrapPanel>
    
                </Grid>
            </Grid>
            <DockPanel Grid.Row="2" Grid.Column="1"  Height="20" HorizontalAlignment="Stretch" Name="dockPanel2" Margin="0" VerticalAlignment="Bottom">
                <StatusBar Height="20" Name="statusBar1" Width="Auto" DockPanel.Dock="Top" VerticalAlignment="Center"   >
                    <TextBlock Name="statusValue">fff</TextBlock>
                </StatusBar>
            </DockPanel>
        </Grid>
    </Window>

    我们看到在下面我放了一个状态栏来显示当前的状态。

  • 相关阅读:
    HTML5 表单自学记录
    HTML5表单
    HTML不常用的表单属性-fieldset
    HTML5-Y音频与视频
    解决HTML5标签兼容的办法搜集
    HTML5标签的兼容处理
    HTML5-语义化标签
    JS自学大全
    HTML5增强的表单
    照片格式的区别
  • 原文地址:https://www.cnblogs.com/zhuzhenyu/p/2937302.html
Copyright © 2020-2023  润新知