zoukankan      html  css  js  c++  java
  • MahApps.Metro demo

    1.  开始
    2.  RightWindowCommand
    3.  Flyout

    1. 开始

    app.xaml

    <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>

    MainWindow.xaml

    <Controls:MetroWindow x:Class="Demo.MainWindow"
                          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                          xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
                          Title="MainWindow"
                          Height="350"
                          Width="525">
        <Grid>
    
        </Grid>
    </Controls:MetroWindow>

    2. RightWindowCommand

    a. 安装 package MahApps.Metro.IconPacks.Modern 用于显示Setting图标

    b. 修改MainWindow.xaml

    <Controls:MetroWindow x:Class="Demo.MainWindow"
                          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                          xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                          xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
                          Title="MainWindow"
                          Height="350"
                          Width="525">
        <Controls:MetroWindow.RightWindowCommands>
            <Controls:WindowCommands>
                <Button>
                    <iconPacks:PackIconModern Kind="Settings"/>
                </Button>
            </Controls:WindowCommands>
        </Controls:MetroWindow.RightWindowCommands>
    </Controls:MetroWindow>

     3. Flyout

    xaml中添加

    <Controls:MetroWindow.Flyouts>
            <Controls:FlyoutsControl>
                <Controls:Flyout Header="Test"
                                 Position="Left"
                                 Theme="Accent">
                    <Grid Width="400" Margin="10">
                            <TextBlock>Hello World</TextBlock>
                    </Grid>
                </Controls:Flyout>
            </Controls:FlyoutsControl>

    click事件

    private void BtnSettings_Click(object sender, RoutedEventArgs e)
            {
                this.ToggleFlyout(0);
            }
    
            private void ToggleFlyout(int index)
            {
                var flyout = this.Flyouts1.Items[index] as Flyout;
                if (flyout == null)
                {
                    return;
                }
    
                flyout.IsOpen = !flyout.IsOpen;
            }

     放在里面

    xaml

       <Grid>
            <Controls:FlyoutsControl Name="Flyouts1">
                <Controls:Flyout Header="设置"
                                 Position="Left"
                                 Theme="Accent">
                    <Grid Width="400" Margin="10">
                        <TextBlock>hello world</TextBlock>
                    </Grid>
                </Controls:Flyout>
            </Controls:FlyoutsControl>
        </Grid>

    代码修改

    var flyout = this.Flyouts1.Items[index] as Flyout;
  • 相关阅读:
    selenium webdriver简介
    web自动化selenium环境搭建
    web自动化基础之web页面组成
    接口测试基础八--接口自动化前期准备
    小程序测试关注点之一-登录授权
    python实现十大经典算法
    pytest 框架之pytest-html报告生成
    pytest 框架与 unittest 框架的对比
    selenium _上传操作
    selenium 常见操作,使用 js 操作-日期框及文本框
  • 原文地址:https://www.cnblogs.com/naergaga/p/9090215.html
Copyright © 2011-2022 走看看