xamlで記述されている動的なWPFUIがあります。
xamlは以下に表示されます。私の問題は、カスタム名前空間が自動的に解決されないことです。
xamlをロードするには、名前空間を持つ各アセンブリを次のようにパーサーコンテキストに設定する必要があります
var context = new ParserContext();
context.XamlTypeMapper = new XamlTypeMapper(new string[] { });
context.XmlnsDictionary.Add("Custom","http://myCompany.de");
context.XamlTypeMapper.AddMappingProcessingInstruction("http://myCompany.de","FooNamespace","FooAssemblyName");
もっと良い方法はありませんか?これは動的に必要です。そして、私はアプリのドメインをスキャンしたくありません。
これは通常の「SystemXamlReader」でどのように行われますか?
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Custom="http://myCompany.de"
x:Class="Foo.Container"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<Custom:FooViewModel/>
</UserControl.DataContext>
<Grid>
</Grid>
</UserControl>