使用這個屬性讓代碼更酷一點
(一)
<Page x:Class="Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="clr-namespace:DH.Class1;assembly=dhLib"
/>
所有http://schemas.microsoft.com/winfx/2006/xaml/presentation命名空間映射到他們所介紹的CLR命名空間。原因可以在自己的項目中使用這個屬性,只需打開AssemblyInfo.cs文件,並追加以下代碼:
[assembly: XmlnsDefinition("http://www.dh.com/xaml/", "DH.Class1")]
(二)
<Page x:Class="Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="http://www.dh.com/xaml/"
/>