I added wpf usercontrol to winform project.
However I failed compilation.
I got errors. error CS0266: Cannot implicitly convert type 'object' to 'string'.
string abc = test.PropertyAccessor.GetProperty("name");
//type of test is Microsoft.Office.Interop.Outlook.Attachment
//test.PropertyAccessor.GetProperty return dynamic.
I found the cause.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomControls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
xmlns:local="clr-namespace:CustomControls" is the cause.
If xmlns:local="clr-namespace:CustomControls" is removed, I don't get error.
Why is that?
I couldn't find the cause, but I resolved it anyway.
I added explicit conversion.
string abc = (string)test.PropertyAccessor.GetProperty("name");