6
我可以讓Kaxaml使用CLR名稱空間加載外部程序集,但這很痛苦,因爲需要大量映射來定位程序集中的所有不同名稱空間,而自定義組件上的XmlnsDefinition將允許一個人逃脫只有一個或幾個。使用自定義XML名稱空間引用Kaxaml中的外部DLL
當尋找一個解決方案,我明顯看出this question但似乎只覆蓋使用CLR的命名空間作爲一切答案似乎爲自定義命名空間的工作(「無法設置未知成員......」)。
例子:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:is="http://schemas.microsoft.com/expression/2010/interactions">
<!-- ... -->
<Button Content="Test">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<is:ChangePropertyAction PropertyName="IsOpen"
TargetName="popup"
Value="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
這是行不通的,但是如果你使用的CLR它:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:is="clr-namespace:Microsoft.Expression.Interactions;assembly=Microsoft.Expression.Interactions"
xmlns:isc="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions">
<!-- ... -->
<Button Content="Test">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<isc:ChangePropertyAction PropertyName="IsOpen"
TargetName="popup"
Value="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
的is
命名空間不在這裏使用,我不得不添加的子命名空間交互程序集。
如果可以使第一種方法起作用,那將是理想的。