ためのDataTemplateが型を見つけることができません別のカスタムレンダラーを参照するC#で新しいDataTemplateを作成しようとするとエラーが発生し、その解決策が見つかりません。私はDataTemplateをしてImageTinted他の場所で働くから私はXamarin.Formsで働いていると私は(UWP)TabbedPageのカスタムレンダラを作成しようとしていた、それは一種の作品...しかし、ときに私の未知の名前空間、Xamarin.Forms UWP
<tint:ImageTinted />
を呼び出さないとき
Windows.UI.Xaml.DataTemplate GetStyledHeaderTemplate() {
StringBuilder tpl = new StringBuilder();
tpl.Append("<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
tpl.Append(" xmlns:tint=\"clr-namespace:MyNamespace.UI;assembly=MyNamespace\"");
tpl.Append(" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">");
tpl.Append("<StackPanel Margin=\"0\" Padding=\"5, 0\" VerticalAlignment=\"Top\">");
tpl.Append("<tint:ImageTinted TintColor=\"White\" Source=\"{Binding UWPIcon}\" Width=\"24\" Height=\"24\" Margin=\"0, 5, 0, 0\" />");
tpl.Append("<TextBlock Padding=\"0\" Margin=\"0, 0, 0, 4\"");
tpl.Append(" Text=\"{Binding Title}\" FontFamily=\"Segoe UI\" Foreground=\"White\" HorizontalAlignment=\"Center\" FontSize=\"13\" />");
tpl.Append("</StackPanel>");
tpl.Append("</DataTemplate>");
return (Windows.UI.Xaml.DataTemplate)XamlReader.Load(tpl.ToString());
}
コードが正常に動作します。
、助けてください!
エラー:
Windows.UI.Xaml.Markup.XamlParseException occurred
HResult=0x802B000A
Message=The text associated with this error code could not be found.
The type 'ImageTinted' was not found because 'clr-namespace:MyNamespace.UI;assembly=MyNamespace' is an unknown namespace. [Line: 1 Position: 339]
Source=
StackTrace:
at Windows.UI.Xaml.Markup.XamlReader.Load(String xaml)
at MyNamespace.UWP.StyledTabbedPageRenderer.GetStyledHeaderTemplate() in D:\...\MyNamespace.UWP\UI\Renderers\StyledTabbedPageRenderer.cs:line 91
at MyNamespace.UWP.StyledTabbedPageRenderer.OnElementChanged(VisualElementChangedEventArgs e) in D:\...\MyNamespace.UWP\UI\Renderers\StyledTabbedPageRenderer.cs:line 35
at Xamarin.Forms.Platform.UWP.TabbedPageRenderer.SetElement(VisualElement element)
at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
at Xamarin.Forms.Platform.UWP.VisualElementExtensions.GetOrCreateRenderer(VisualElement self)
at Xamarin.Forms.Platform.UWP.Platform.<SetCurrent>d__51.MoveNext()
私は、名前空間のすべての組み合わせを試してみましたが、同じエラーを取得しました:/ – user8971976