zoukankan      html  css  js  c++  java
  • uwp使用资源限定符Devicefamily不同设备使用不同布局

    步骤:

    1. 删除MainPage.xaml
    2. App下新建两个文件夹:devicefamily-desktop,devicefamily-mobile
    3. App下新建MyPage.cs类
    4. 两个文件夹内新建MyPage.xaml文件,注意指向的类和命名空间为MyPage.cs类和它的命名空间
    5. 生成项目
    6. 初始化组件

    初始化组件:MyPage.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.UI.Xaml.Controls;
    
    namespace App1
    {
        public partial class MyPage : Page
        {
            public MyPage()
            {
                this.InitializeComponent(); // app生成后自动产生
            }
        }
    }

    两个文件下的MyPage.xaml

    devicefamily-desktop:
    <Page
        x:Class="App1.MyPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App1"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
        <Grid>
            <TextBlock Text="桌面" FontSize="60" HorizontalAlignment="Center"/>
        </Grid>
    </Page>
  • 相关阅读:
    RN组件的生命周期
    调试菜单
    React Native 之项目的启动
    React Native 之组件的定义
    Es6 之 const关键字
    2019年开发App记录
    upc-魔法石01字符串ab字符串变换问题——尺取
    中石油训练混合训练第七场
    魔法序列-upc
    MAX 的读书计划——dp
  • 原文地址:https://www.cnblogs.com/maoriaty/p/9065347.html
Copyright © 2011-2022 走看看