【发布时间】:2018-01-31 02:02:05
【问题描述】:
我是 XAML 的新手。我想知道所有的 x: 和 :x 都是关于什么的。关于 XAML 的教程没有解释这一点(或者我还没有阅读足够的内容)。
例如:
<Window x:Class="WpfTutorialSamples.WPF_Application.ResourceSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="ResourceSample" Height="150" Width="350">
<Window.Resources>
<sys:String x:Key="strHelloWorld">Hello, world!</sys:String>
</Window.Resources>
<StackPanel Margin="10">
<TextBlock Text="{StaticResource strHelloWorld}" FontSize="56" />
<TextBlock>Just another "<TextBlock Text="{StaticResource strHelloWorld}" />" example, but with resources!</TextBlock>
</StackPanel>
</Window>
这些行中的 x 是什么意思?
- 窗口 x:Class="WpfTutorialSamples.WPF_Application.ResourceSample"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" sys:String
- x:Key="strHelloWorld">你好,世界!
【问题讨论】: