zoukankan      html  css  js  c++  java
  • XAML的硬性编码

    以下内容摘自刘铁猛著的《深入浅出WPF》一书。

    <Window x:Class="WpfApplication1.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">

    ...

    </Window>

    为何名称空间看起来像主页地址呢?

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    这是XAML的硬性编码(hard-coding),只要见到这些字符串,就会把一系列必要的程序集(Assembly)和程序集中包含的.NET名称空间引用进来。

    默认引用进来的两个名称空间格外重要,它们对应的程序集和.NET名称空间如下:

    http://schemas.microsoft.com/winfx/2006/xaml/presentation对应

    System.Windows

    System.Windows.Automation

    System.Windows.Controls

    System.Windows.Controls.Primitives

    System.Windows.Data

    System.Windows.Documents

    System.Windows.Forms.Integration

    System.Windows.Ink

    System.Windows.Input

    System.Windows.Media

    System.Windows.Media.Animation

    System.Windows.Media.Effects

    System.Windows.Media.Imaging

    System.Windows.Media.Media3D

    System.Windows.Media.TextFormatting

    System.Windows.Navigation

    System.Windows.Shapes

    可以在XAML中直接使用这些CLR名称空间中的类型

    http://schemas.microsoft.com/winfx/2006/xaml则对应一些与XAML语法和编译相关的CLR名称空间。使用这些名称空间中类型时需要加x前缀,因为它们被映射到了名为x的名称空间中。

  • 相关阅读:
    菜鸟fork()创建进程新见解
    Linux下select函数的使用
    URAL 1029 Ministry
    URAL 1036 Lucky Tickets
    URAL 1031 Railway Tickets
    URAL 1028 Stars
    URAL 1032 Find a Multiple
    URAL 1037 Memory Management
    URAL 1033 Labyrinth
    URAL 1039 Anniversary Party
  • 原文地址:https://www.cnblogs.com/cnland/p/2794886.html
Copyright © 2011-2022 走看看