所有內容都發生在同一VS項目中。我有一個自己的資源字典文件。當我嘗試以編程方式加載時,出現錯誤無法使用轉換器加載資源字典
「無法創建未知類型'{clr-namespace:MyAssembly.Helpers} IsNullConverter」。
這是我如何加載:
StreamResourceInfo stream = Application.GetResourceStream(new Uri(@"MyAssembly;component/Resources/Resources.xaml", UriKind.Relative));
this.dynamicResources = XamlReader.Load(stream.Stream) as ResourceDictionary;
這裏是資源字典:
<ResourceDictionary 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:helpers="clr-namespace:MyAssembly.Helpers">
<helpers:IsNullConverter x:Key="IsNullConverter" />
Styles go here...
注意它綁定到代碼隱藏文件,但沒有什麼它。資源文件的Build-Action設置爲「Resource」。這從今天早上開始讓我瘋狂起來,至今仍不知道究竟是怎麼回事......
幫助。 謝謝。
哪裏'MyAssembly.Helpers.IsNulLConverter'定義?解析器是,提供路徑下尋找類和未能找到預期的元數據... – code4life