ユーザーコントロールを作成し、そのアセンブリを2番目のユーザーコントロールに渡しました。Xamlファイルに正しい名前空間を書きましたが、それでもCLR clr-namespace is not defined in assembly
この問題を解決するにはどうすればよいですか? 誰でも私を助けることができますか?私のコードは次のとおりです。
最初の UserControl XAML ファイル:
<xmlns:local="clr-namespace:DesktopApplication.Roles">
<UserControl.Resources> <local:StringToColorConverter x:Key="StringToColorConverter"/>
</UserControl.Resources>
2 番目の UserControl .CS ファイル:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
namespace DesktopApplication.Admin_Roles
{
public partial classCategoryTab : UserControl
{
public CategoryTab()
{
InitializeComponent();
}
public class Data
{
public string Name { get; set; }
public string LastName { get; set; }
public string Color { get; set; }
public bool isactive { get; set; }
}
public class StringToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (Color)ColorConverter.ConvertFromString((string)value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return ((Color)value).ToString();
}
}
}