XmlnsDefinitionAttribute

使用這個屬性讓代碼更酷一點
(一)
<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/"
/>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章