我对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是什么意思?
- Window x:Class="WpfTutorialSamples.WPF_Application.ResourceSample"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" sys:String
- x:Key="strHelloWorld">Hello, world!